Internet Explorer 是否支持pushState 和replaceState?
有谁知道 Internet Explorer 是否支持 操纵浏览器历史记录?考虑到这些刚刚在 Firefox 4 中实现,我不禁屏住呼吸,但有人知道它们是否会在 IE9 中实现吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
浏览器兼容性信息的最佳网站可能是 CanIUse。这是关于历史的部分。
摘要 - IE9:否,IE10:是(从平台预览版 3 开始)
IE9 的第一个候选版本(2011 年 2 月 10 日发布)不支持 History.pushState 或 History .replaceState。一般来说,产品进入 RC 阶段后不会添加新功能,因此最终的 IE9 不太可能支持这些方法。
Microsoft 对 IE9 所具有的功能为开发人员提供了很好的概述。
更新:Internet Explorer 9 已发布(2011 年 3 月 14 日),并且绝对不支持
history.pushState()
或history.replaceState()< /code>.
更新 2:IE10仍然不支持pushState/replaceState。
更新 3:IE10 的平台预览 3 支持历史记录 API! 详细信息
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()
orhistory.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不支持。
但是,您可以使用 Polyfill 来解决此问题 - History.js https://github.com /browserstate/history.js。
Modernizr 在这里很好地列出了 HTML 5 Polyfills https://github.com /Modernizr/Modernizr/wiki/HTML5-跨浏览器-Polyfills。
需要注意的是,它会在仅支持 HTML 4 功能的浏览器中向您的网址添加查询字符串。
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 引入了对 HTML5 草案规范的历史记录接口的支持,其中包括使您能够管理站点的历史记录堆栈和 URL 的方法。
原始链接:https://msdn。 microsoft.com/en-us/library/ie/hh920758(v=vs.85).aspx
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
顺便说一句,你可能会因为pushState()中的绝对路径而得到这样的错误。当我设置相对路径时,错误消失了。
Btw you can get such error in reason of absolute path in pushState(). When i set relative path error was disappeared.