【发布时间】:2013-10-28 12:12:49
【问题描述】:
在我的一个应用程序中,我使用window.history.pushState() 方法来更新窗口 URL。但由于IE < 10 不支持HTML5 的历史API,我一直在寻找替代方案。 SO上很多其他问题的答案建议使用history.js插件。
从 history.js 插件提供的文档来看,它的用法并不是很清楚。我已将插件添加到模板中的 <head></head> 部分,但在 IE9 上我仍然收到错误消息:
SCRIPT438: Object doesn't support property or method 'pushState'
params.js, line 37 character 5
报错的函数如下
/**
* updates the window url according to the given parameters.
*/
function updateUrl(params) {
var path = window.location.pathname;
var url = $.param.querystring(path, params);
url = decodeURIComponent(new_url).replace("#", "", "g");
window.history.pushState(null, null, new_url);
}
【问题讨论】:
标签: html internet-explorer-9 pushstate history.js