单击浏览器的后退按钮时重定向到特定页面 [英] redirecting to a specific page when clicking browser's back button
问题描述
这是一个nooby问题,但是确实存在:
我有一个网站,用户只能通过下一步"和后退"按钮在页面之间导航.即有一个用户必须遵循的向导.向导的一部分包含不同的页面,一部分包含相同的页面,但是div有所变化(但从用户的体验来看,它是不同的页面).
每当用户单击浏览器的后退"按钮时,我只想将其重定向到向导的第一页.
如果可能且简单,我宁愿不使用(还有另一个)插件.
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.
谢谢.
推荐答案
无法阻止浏览器后退按钮的默认行为-没有浏览器允许这样做,因为这会带来潜在的安全风险和不良的用户体验.
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.
话虽如此,这里有一些技巧可以满足您的需求.
看一下这个:
检测URL中的后退按钮/哈希更改
With that said, there are tricks out there that may satisfy your needs.
Check this out:
Detecting Back Button/Hash Change in URL
这篇关于单击浏览器的后退按钮时重定向到特定页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!