Does onHashChange work in Safari?

六眼飞鱼酱① 提交于 2019-12-04 09:53:08

In our app we poll to check for changes:

$b.hashCheck = setInterval(
    function(){
        if ( window.location.hash !== $b.C.current_hash){
            $b.C.current_hash = window.location.hash;

            //call the on change action here

        }
    },$b.C.hashCheckDelay
);

$b is the global object we use for our namespace and hashCheckDelay was empirically set at 120ms.
While it looks a bit sad to do this kind of process, there isn't any performance issue on any browser we tested.

In Safari 4.0.4 it's not working yet but in the latest one works fine. And I didn't find any acceptable solutions to track if the hash has changed for those browsers which don't support onHashChange.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!