javascript - Why popstate doesn't fire in Firefox -


i have html page. on chrome, if click several time in button2 , click on navigator button

<html> <head> <script> function button_onclick(){ var stateobj = { foo: "bar" }; history.pushstate(stateobj, "page 2", "bar.html"); } function onpopstate(){ console.log("location: " + document.location + ", state: " + json.stringify(event.state)); } window.addeventlistener('popstate', onpopstate, false); </script> </head> <body> <button type="button" onclick="button_onclick()">button 2</button> </body> </html> 

i can see in console:

location: http://somedomain:8080/examples/bar.html, state: {"foo":"bar"} 

if try firefox don't see nothing? tested firefow 13.0.1 pretty annoying if want manage history using html5 history api

found on question , helped me :

popstate isn't supposed called when click link. it's called when user navigates back/forward button.

everything working way supposed to.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -