Setting location.hash in frames

后端 未结 7 2014
清酒与你
清酒与你 2021-02-09 15:19

I am using ajax to update the location of a page in a frame. But when setting the location of the hash (on Chrome and some versions of IE (5.5) specifically, but occasionally on

7条回答
  •  心在旅途
    2021-02-09 15:46

    I was having this problem as well. My situation allowed me to create a window unbind event that set the hash with the value I wanted it too as the user browser to the next page or refreshed. This worked for me, but not sure it will work for you.

    With jquery, I did:

    if($.browser.webkit){
        $(window).unload(function() {
            top.window.location.hash = hash_value;
        });
    }else{
        top.window.location.hash = hash_value;
    }
    

    Technically you don't need to do the webkit check, but I thought for people who use firefox, it might be nice to see the correct hash value before they refresh the frameset.

    -Jacob

提交回复
热议问题