How to trigger change when using the back button with history.pushstate and popstate?
The popstate only contains a state when there is one. When it goes like this: initial page loaded new page loaded, with state added via pushState back button pressed then there is no state, because the initial page was loaded regularly, not with pushState. As a result, the onpopstate event is fired with a state … Read more