我正在使用window.History.pushstate
。它在Chrome中运行良好,但在IE8中它附加路径#。
请帮忙。
以下是我的代码段:
var History = window.History;
History.pushState(null, null, "/abc");
答案 0 :(得分:2)
你写了window.History。你有Benjamin Lupton的history.js吗? window.History和window.history与window不同.History引用history.js,这使得历史向后兼容html4浏览器。
看看这两个:
答案 1 :(得分:1)
你可以参考以下答案
IE9及以下版本不支持pushState
。调用以下行时会出现异常:
window.history.pushState(null, null, pathFullPage);
SCRIPT438: Object doesn't support property or method 'pushState' ?terms_and_conditions, line 62 character 21
您可能有兴趣查看此处讨论的一些变通方法:Emulate/polyfill history.pushstate() in IE