开发者

How to bind the event of clicking the back button in a browser to a specific function (for all the browsers)?

开发者 https://www.devze.com 2023-02-25 00:39 出处:网络
I have got two scenarios: user accesses to page A; then click on a link to go to page B; click back button to go back to page A;

I have got two scenarios:

  1. user accesses to page A; then click on a link to go to page B; click back button to go back to page A;

  2. user accesses to page A; then click on a link to go to page B; click on another link to go to page A;

I need a particular behavior to happen when the user is back to page A clicking the back button. Is that any way to do that in all the browsers. If I bind a function to "beforeunload" event in page B, the event is triggered in whate开发者_C百科ver way I am leaving the page.


I had almost the exact same question I think this is what you need https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

0

精彩评论

暂无评论...
验证码 换一张
取 消