140

Does anybody know if Internet Explorer supports the history.pushState() and history.replaceState() methods for manipulating browser history? Considering these are just being implemented in Firefox 4, I'm not holding my breath, but does anybody know if they're coming in IE9?

Nicole
  • 30,999
  • 11
  • 69
  • 94
David Johnstone
  • 23,034
  • 14
  • 64
  • 71
  • 18
    For what it's worth [History.js](https://github.com/balupton/History.js) provides the same HTML5 API while gracefully degrading any browser that doesn't support it (including support for data and titles, and replaceState functionality). Using that would mean you wouldn't have to change your code for the IE9 changes. – balupton Jan 30 '11 at 13:53
  • 3
    Depressing indeed if IE9 does not add this. – Eric Wahlforss Nov 28 '10 at 19:12
  • 2
    On the other hand, some argue against falling back to hashes. http://danwebb.net/2011/5/28/it-is-about-the-hashbangs – David Johnstone Jun 01 '11 at 04:01
  • @balupton, I followed your instructions on downloading and installing `history.js` but after I refreshed my page, errors like `ReferenceError: jQuery is not defined` are on my console, about 23 of them. What did I do wrong? Please help! – Tsukimoto Mitsumasa Sep 19 '12 at 17:10
  • 1
    @CHiRiLo: You need to include a reference to [jQuery](http://jquery.com). This is a javascript library from Google that is widely used, and will make your life a lot easier when working with javascript in your web sites. – awe Oct 16 '12 at 08:57
  • 5
    Google isn't the primary developer for jQuery (it might have contributed); it does host it on its CDN though. – trojjer Mar 01 '13 at 11:23

4 Answers4

196

Probably the best site for browser compatibility information is CanIUse. Here's the section on history.

Summary - IE9: no, IE10: yes (as of platform preview 3)

The first Release Candidate of IE9 (released 10th Feb 2011) does not support history.pushState or history.replaceState. Generally no new features are added after a product gets to RC stage so it is very unlikely that the final IE9 will support these methods.

Microsoft have a good overview for developers of the features IE9 does have.

Update: Internet Explorer 9 was launched (on 14th March 2011) and definitely does not support history.pushState() or history.replaceState().

Update 2: The current platform preview of IE10 still does not support pushState / replaceState.

Update 3: Platform Preview 3 of IE10 supports the history API! Details

dave1010
  • 14,332
  • 6
  • 64
  • 64
  • As of today, IE10 history has a **bug** making it useless, the popstate event does not fire. Details here: http://stackoverflow.com/questions/14698299/internet-explorer-10-and-popstate-not-binding/15809188#15809188 – citykid Apr 04 '13 at 10:58
17

IE9 doesn't support it.

You can however use a work around using a Polyfill to get the functionality - History.js https://github.com/browserstate/history.js.

Modernizr do a good job listing HTML 5 Polyfills here https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills.

The caveat is that it will add a query string to your URL in browsers that only support HTML 4 features.

Sebastian Patten
  • 6,318
  • 4
  • 36
  • 45
0

Internet Explorer 10 introduces support for the History interface of the HTML5 draft specification, which includes methods that enable you to manage a site's history stack and URL.

The original link:https://msdn.microsoft.com/en-us/library/ie/hh920758(v=vs.85).aspx

QC-cheetah
  • 116
  • 2
  • 7
0

Btw you can get such error in reason of absolute path in pushState(). When i set relative path error was disappeared.

f0rmat1k
  • 55
  • 4