【问题标题】:History.js onstatechange in IE7 does not workIE7 中的 History.js onstatechange 不起作用
【发布时间】:2013-07-01 04:09:51
【问题描述】:

我集成了 History.js,这段代码在 URL 更改时运行:

History.Adapter.bind(window,'statechange',function(){ 
    var State = History.getState();
    alert(State.url)
    showPage(State.url);
});

它在除IE7(IE8的兼容模式)之外的所有浏览器中都能正常工作。我认为 History.js 会处理这个问题。

IE7不理解onStateChange事件是真的吗?这种情况下可以使用什么窗口事件?

【问题讨论】:

    标签: javascript cross-browser internet-explorer-7 history.js onreadystatechange


    【解决方案1】:

    从兼容性说明中指出:

    MSIE 6 和 7 有时即使被告知也不应用哈希(需要再次调用 apply 函数)

    https://github.com/browserstate/History.js/

    【讨论】:

    • 嗯...文档中的那一行如下:“History.js 解决了以下浏览器错误:”如果 History.js 解决了上述 HTML4 浏览器错误列表,那么这个答案是周期性的,并且与正确相反,因为它显然仍然在 IE7 中中断 - 对吧?
    猜你喜欢
    • 2012-04-17
    • 2011-02-22
    • 2012-07-06
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2013-06-09
    • 1970-01-01
    相关资源
    最近更新 更多