如何从URL中隐藏锚标签 [英] How to hide anchor tag from URL

查看:150
本文介绍了如何从URL中隐藏锚标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < a href =

如何隐藏地址栏中以下链接href的哈希值?的index.php#的dev_name>

所以它会将我重定向到 index.php#dev_name ,但我希望地址栏只显示 index.php

解决方案

您可以使用Javascript onclick事件。浏览器仍然会显示 index.php ,但onclick事件将首先触发,并将浏览器重定向到正确的页面。

 < a href =index.phponclick =location.redirect('index.php#dev');> 


How can I hide the hash value from the following link href in the address bar?

<a href="index.php#dev_name">

So it'll redirect me to a the index.php#dev_name, but I want the address bar to only show index.php

解决方案

You can use a Javascript onclick event. The browser will still show index.php, but the onclick event will trigger first, and redirect the browser to the right page.

<a href="index.php" onclick="location.redirect('index.php#dev');">

这篇关于如何从URL中隐藏锚标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆