【问题标题】:Chrome history problemChrome历史记录问题
【发布时间】:2010-04-11 16:59:36
【问题描述】:
    $("#table_exams tbody tr").click(function (event)
        {
            window.location.href="#" +$(this).attr("exam_ID");      
            window.location.href="/medilab/prototypes/exams/edit?examId=" + $(this).attr("exam_ID") +"&referer=" + referer;     
            row_select(this);
        });

 $(document).keypress(function (event) {
            if(event.keyCode==13) $(row_selected).trigger("click");

        });

我只有在 chrome 中对此有一点问题......当用户返回时,chrome 会忽略我的脚本添加的最后一个 href 哈希......但是当我双击它时,它就可以了...... IE 和 Firefox 运行良好...

【问题讨论】:

    标签: jquery google-chrome


    【解决方案1】:

    我会尝试location.hash,它的行为更加一致,如下所示:

    window.location.hash="#" +$(this).attr("exam_ID");      
    window.location.href="/medilab/prototypes/exams/edit?examId=" + $(this).attr("exam_ID") +"&referer=" + referer;     
    

    Chrome 倾向于优化调用堆栈,它的跟踪引擎知道 location.href 仅以导致最后一组操作的方式设置...这可以防止跟踪优化发生(jQuery 在这里有类似的问题, Sizzle 引擎中有特定的代码来处理 Chrome 这样做的事实。

    【讨论】:

    • 在使用 location.href 之前是 location.hash 但它有同样的问题:(
    • @Parhs - 我认为这个问题现在会解决,因为同样的问题会影响 gmail(#inbox 错误),但看起来它仍然是开放的。抱歉,这不是好消息……但 chrome 团队需要修复一些问题:code.google.com/p/chromium/issues/detail?id=1016
    猜你喜欢
    • 2011-04-02
    • 1970-01-01
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-26
    • 1970-01-01
    • 2014-06-10
    相关资源
    最近更新 更多