binding popstate event not working
Type this into the console
window.onpopstate = function() {alert(1);}; history.pushState({}, '');
then click the back button.
I prefer adding the popstate listener as follows, to prevent overwriting of what's already in window.onpopstate
:
window.addEventListener('popstate', function(){alert(1);});