更新时间:2023-02-23 14:53:43
您可以使用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');">