redirecting to a specific page when clicking browser's back button

拟墨画扇 提交于 2019-12-24 03:07:51

问题


it's a bit of a nooby question, but there it goes:
i have a site where the user can only navigate from page to page via next and back buttons. i.e there is a wizard the user must follow. part of the wizard includes different pages and part includes the same page but with changing divs (but from user experience its a different page).
i would like to simply redirect the user to the first page of the wizard, whenever he clicks on the browser's back button.
if possible and simple, i prefer doing so without the use of (yet another) plugin.

thanks.


回答1:


It's not possible to prevent the default behavior of the browser's back button - no browser allows that because it would pose potential security risks and a bad user experience.

With that said, there are tricks out there that may satisfy your needs.
Check this out: Detecting Back Button/Hash Change in URL



来源:https://stackoverflow.com/questions/6830687/redirecting-to-a-specific-page-when-clicking-browsers-back-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!