function hashchange(){}
if (!('onhashchange' in window)) {
var oldHref = location.href;
setInterval(function() {
var newHref = location.href;
if (oldHref !== newHref) {
var _oldHref = oldHref;
oldHref = newHref;
hashChange.call(window, {
'type': 'hashchange',
'newURL': newHref,
'oldURL': _oldHref
});
}
}, 100);
} else if (window.addEventListener) {
window.addEventListener("hashchange", hashChange, false);
}
else if (window.attachEvent) {
window.attachEvent("onhashchange", hashChange);
}
不同浏览器添加hashchange
最新推荐文章于 2024-04-25 11:57:52 发布