4 ms·
Can someone explain to me why hijacking of the back button is even possible? It's obviously something that browsers could fix, and the fact they don't fix it me
by mysterypie 9y ago
Can someone explain to me why hijacking of the back button is even possible? It's obviously something that browsers could fix, and the fact they don't fix it means that there must be some legitimate uses. But what legit use?
- reificator 9y agoIn a perfect world, it would be used by single page apps that are driven by JavaScript to provide the same benefits of linking, history navigation, and so on, without having to actually load a new page. Think an online webmail client, where each time you view an email it adds a new item to your history.
- ChrisSD 9y agoJavaScript apps. If you dynamically load content using js, the user will likely expect the back button to undo that change.
- sp332 9y agoIn this case I think it doesn't hijack your back button. The first page redirects to a second page, and they both end up in your history. If they used history.replaceState() then you'd only have one entry in your back-stack. https://developer.mozilla.org/en-US/docs/Web/API/History_API https://developer.mozilla.org/en-US/docs/Web/API/History_API