I've been trying to get a single page application working on Chrome, Safari and Firefox but Firefox doesn't seem to be executing the window.onpopstate at all.
window.onpopstate = function() {
fullpath = location.pathname;
console.log(fullpath);
}
I have .htaccess routing all requests back to index.html so when the the client makes a request, the browser stores the url as a javascript variable and passes it through the js in index.html
When run in firefox, the variable isn't passed to the index.html page. Anyone have a solution or any suggestions for how to look deeper into this issue?
From the Firefox
popstate
documentation:As epascarello says in his comment, initialize your variables in the
load
event and everything should work in Chrome/Safari and Firefox.