Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 history pushState is not working

Tags:

javascript

Not sure what I'm doing wrong, but this small bit of code does not work:

window.history.pushState("foo", "foo", "foo");

It will generate the following error in firefox 29:

TypeError: window.history.pushState is not a function
like image 281
nablex Avatar asked Feb 06 '26 14:02

nablex


1 Answers

Apparently one of the scripts I included had a declaration:

var history = ...;

Unbeknownst to me, all vars on the root actually live in the window scope so the custom history var actually overwrote the original window.history.

like image 60
nablex Avatar answered Feb 09 '26 11:02

nablex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!