简体   繁体   中英

How to hide anchor tag from URL

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');">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM