Skip to content Skip to sidebar Skip to footer

Window.history.pushstate Not Going Back In History

I have a little problem experimenting with the history.pushstate event. I set it up so that the url of the page would be the actual URL of the page loaded via AJAX and that works j

Solution 1:

Figured it out, I just added:

window.addEventListener("popstate", function(e) {
    loadPage(location.pathname);
});

to the end of the page

Solution 2:

I have same problem, but I fixed it. It's very easy

code example:

window.addEventListener("popstate", function(e) {
    window.location.href = location.href;
});

Solution 3:

Yeah Safari iOS has a fair few bugs with the HTML5 History API - actually, all the HTML5 browsers work differently than each other, so the functionality isn't really that standard right now.

There is History.js which solves the cross-browser compatibility problems and also provides an optional HTML4 hash fallback if you'd like. You can also refer to the "Notes on Compatibility" section for information on all the browser bugs that it fixes.

Post a Comment for "Window.history.pushstate Not Going Back In History"