窗口绑定POPSTATE [英] window bind POPSTATE

查看:78
本文介绍了窗口绑定POPSTATE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  $(window).bind(popstate,function(){
alert('popstate');
});

在第一次加载时,警报会使用FireFox和Chrome启动,但不启动Safari。这是为什么?其他人看过这个,知道如何最好地解决这个问题吗?



谢谢

解决方案

现在情况正好相反。 Chrome修复了该错误,现在在页面加载时触发popstate,但Firefox 4(自RC以来)已经脱离规范并且现在不会触发popstate

更新:HTML5规范在2011年更改为状态popstate不应在网页加载时触发。 Firefox和Chrome现在都可以做到Firefox 4以及 Chrome 34


Given the following:

$(window).bind("popstate", function() {
    alert('popstate');
});

On first load, the alert fires with FireFox and Chrome but not Safari. Why is that? Anyone else seen this and know how to best solve for this?

Thanks

解决方案

The situation is now reversed. Chrome has fixed the bug and now fires popstate on page load but Firefox 4 (since RC) has departed from the spec and now does not fire popstate!

UPDATE: The HTML5 spec was changed in 2011 to state popstate should not fired on page load. Both Firefox and Chrome now do the right thing as of Firefox 4 and Chrome 34.

这篇关于窗口绑定POPSTATE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆