简体   繁体   English

从页面的 url 中删除页面的锚点链接

[英]to delete a page's anchor's link from page's url

file:///portfolio/index.html#wrapper

It is the first page's link and #wrapper in the end, is an anchor (specific part of page) in this page.它是第一页的链接,最后是#wrapper ,是此页面中的锚点(页面的特定部分)。 On this specific part, there is a link to second page.在这个特定部分,有一个指向第二页的链接。 I click the link and go to the second page but when click the browser's back button it backs to the specific part of first page but I want to delete the #wrapper from page's link to back to top of the page.我单击链接和 go 到第二页,但是当单击浏览器的后退按钮时,它返回到第一页的特定部分,但我想从页面的链接中删除#wrapper回到页面顶部。 How can I do this (by browser's back button)?!我该怎么做(通过浏览器的后退按钮)?!

You can't override browser's "back button", there isn't any function to do things like this in javascript.您不能覆盖浏览器的“后退按钮”,在 javascript 中没有任何 function 可以执行此类操作。

But there is a JavaScript library that will help you doing this, which is called Really simple history但是有一个 JavaScript 库可以帮助你做到这一点,它被称为真正简单的历史

And this will help you.将对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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