1
在我的一个应用程序中,我使用window.history.pushState()
方法来更新窗口URL。但是,由于IE < 10
不支持HTML5的历史API,我正在寻找替代方案。 SO上的很多其他问题的答案建议使用history.js
插件。使用history.js与IE9
从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);
}
你是在用结合“的window.history”而不是“window.history的”与history.js。与初始化无关=) – Dave