var page = require('webpage').create();
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
page.open('data:text/html,'+
'<body><script>window.addEventListener("popstate", function () { console.log("Event popstate")}); </script></body>',
function (status) {
console.log(status);
});
In chorme and firefox is event is fired only when the url to accessed was placed in the history with history.pushState or history.replaceState
This behavior on phantomjs is the same presenting in some old versions of chrome
@ariya be fixed in 2.x? or not.
@geminiyellow Did you try it?
@ariya window.onpopstate is still firing on page load in phantomjs 2.1
same for me
@alex-voigt kind of annoying, but i attached the listener using a timeout (just to fix my tests 馃槮 )
setTimeout((function() {
window.onpopstate = function(event) {
return window.location.href = window.location.href;
};
}), 1000);
I have the same problem. Really annoying. :(
Same problem here...
Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
Most helpful comment
@alex-voigt kind of annoying, but i attached the listener using a timeout (just to fix my tests 馃槮 )