Does Internet Explorer support pushState and replaceState?

我们两清 提交于 2019-11-26 11:42:52

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

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.

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!