IE history push state

arik picture arik · Jul 29, 2012 · Viewed 20.8k times · Source

I have a webpage where the user has the possibility to display the terms and conditions without reloading the page, via AJAX. That, in itself, is no problem, however, I am also trying to push a history state.

That works fine in most browsers, except in IE. For some inexplicable reason, there, the content is loaded via AJAX, but also, a new tab is opened with the previous page. How can I fix this?

You can see the example on this webpage ( http://galaxy-battle.de ), try clicking on "T&Cs" in the "Join"-box.

Answer

Sergei Grebnov picture Sergei Grebnov · Aug 1, 2012

IE9 and below doesn't support pushState. You have an exception when calling the following line

window.history.pushState(null, null, pathFullPage);

SCRIPT438: Object doesn't support property or method 'pushState' ?terms_and_conditions, line 62 character 21

You may probably be interesting looking on some workarounds discussed at Emulate/polyfill history.pushstate() in IE