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