简体   繁体   中英

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. 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. 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.

But there is a JavaScript library that will help you doing this, which is called Really simple history

And this will help you.

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