开发者

Chrome history problem

开发者 https://www.devze.com 2022-12-26 16:51 出处:网络
$(\"#table_exams tbody tr\").click(function (event) { window.location.href=\"#\" +$(this).attr(\"exam_ID\");
    $("#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");

        });

I have a little problem with this only in chrome...When user goes back chrome ignores the last href hash that my script added..but when i do a doubleclick its ok... IE and Firefox work great...


I would try location.hash which is a bit more consistent in behavior, like this:

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

Chrome tends to optimize the callstack, it's tracing engine knows the location.href is only set in a way that results in an action in the last set...this prevents that tracing optimization from happening (jQuery has similar issues here, there's specific code in the Sizzle engine to cope with the fact Chrome does this).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号