I’ve started to test History.js. After understanding how it works and that there is no popstate, instead there is statechange. I’m looking for a way to differ when the back button of the browser has been pressed.
The reason is that I need to know the URL before the state moved, from the one I’m going to. With the gist the project includes, only the URL we go to is looked.
I hope the solution is not to track latest URL visited in a global variable.
Thanks
I finally managed all links using
History.pushState, that way there is no need to differ a back button pressed. We handle all state changes the same way.Edit: Found these two issues in History.js’ Github, might help someone.
https://github.com/browserstate/history.js/issues/70
https://github.com/browserstate/history.js/issues/47