I am using History API for my web app and have one issue.
I do Ajax calls to update some results on the page and use history.pushState()
in order to update the browser's location bar without page reload. Then, of course, I use window.popstate
in order to restore previous state when back-button is clicked.
The problem is well-known — Chrome and Firefox treat that popstate
event differently. While Firefox doesn't fire it up on the first load, Chrome does. I would like to have Firefox-style and not fire the event up on load since it just updates the results with exactly the same ones on load. Is there a workaround except using History.js? The reason I don't feel like using it is — it needs way too many JS libraries by itself and, since I need it to be implemented in a CMS with already too much JS, I would like to minimize JS I am putting in it.
So, would like to know whether there is a way to make Chrome not fire up popstate
on load or, maybe, somebody tried to use History.js as all libraries mashed up together into one file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…