Is there a way using Jquery to detect the back button being pressed cross browsers

后端 未结 2 680
后悔当初
后悔当初 2020-11-30 09:37

I have a website that is on a slide show and when the user presses the back button I would like it to go back to the album view not the prior and prevent page. Is there a wa

2条回答
  •  悲&欢浪女
    2020-11-30 10:06

    You should:

    1. Set location.hash when page state changes.
    2. When location.hash changed by user (for example, by pressing back button) render appropriate page contents.

提交回复
热议问题