最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

My #id is not showing in the url when the user clicks on the anchor tag

programmeradmin2浏览0评论

I am working on my WordPress website and when the user clicks on the <a href="#id"> tag, the #id is not showing in the URL and because of that, when the user clicks on the back button, it is taking me to the back not on the top of the page.

I want that, when the user click on the <a href="#id"> tag and it moves to that id but when the user clicks on the back button, it should take me to the top of the page. Now, it is taking me to the back page.

Any help is much appreciated.

I am working on my WordPress website and when the user clicks on the <a href="#id"> tag, the #id is not showing in the URL and because of that, when the user clicks on the back button, it is taking me to the back not on the top of the page.

I want that, when the user click on the <a href="#id"> tag and it moves to that id but when the user clicks on the back button, it should take me to the top of the page. Now, it is taking me to the back page.

Any help is much appreciated.

Share Improve this question asked Nov 28, 2019 at 14:14 Rahul KumarRahul Kumar 2074 silver badges20 bronze badges 1
  • You need to give the top its own anchor then, because the url without any fragment it is not automatically associated to the top. Also before any other user interaction, update the url with the fragment you associate to the top, to allow the history go back to it. – Jesús Franco Commented Nov 29, 2019 at 2:38
Add a comment  | 

1 Answer 1

Reset to default 1

The solution is: Just add the page scroll id plugin.

After installing the plugin, Go to the Links behavior section:

Check this option: Append the clicked link’s hash value (e.g. #id) to browser’s URL/address bar.

By doing this, id shows in the URL and when you click the back button after going to the id, the page will come to the own page.

发布评论

评论列表(0)

  1. 暂无评论