Reputation: 2424
I am using custom history manipulation on my onepage application (with history.pushState
). As the user presses the browser native back button the site does not reload (thus not displaying the right content). I fixed this by listening for a window.onpopstate
event where Id just reruning the initation script.
This however causes the user to be stuck on my page since as he tries to go back I simply reload the page, disreguarding if the page he wants to go to is on the same origin as mine or not. I would like somewhat like this:
window.onpopstate = () => {
if (/*Site is same origin*/) load();
else {
//do Nothing
}
};
How would I approch this?
Upvotes: 0
Views: 30