页面加载时HTML5 onpopstate [英] HTML5 onpopstate on page load

查看:152
本文介绍了页面加载时HTML5 onpopstate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用新的HTML5 onpopstate事件。使用Firefox 4时,window.onpopstate事件在页面加载时触发,而在Webkit中,这似乎不是这种情况。



哪一个是正确的行为?

解决方案


导航到会话历史记录条目时,在某些情况下会触发popstate事件。


http://www.whatwg.org/specs/web-apps/current-work/#event-popstate



从我的理解,尽管我可能是错误的,看到加载页面意味着历史被创建并遍历到,是的,它应该在页面加载时被触发。



另请参阅,

http://www.mail-archive.com/whatwg@lists.whatwg.org/msg19722.html





https://developer.mozilla.org/en-US/docs/Web/Guide/API / DOM / Manipulating_the_browser_history


I'm using the new HTML5 onpopstate event. Using Firefox 4 the window.onpopstate event is triggered on a page load whilst in Webkit this does not seem to be the case.

Which is the correct behaviour?

解决方案

The popstate event is fired in certain cases when navigating to a session history entry.

http://www.whatwg.org/specs/web-apps/current-work/#event-popstate

From my understanding, though I could be wrong, seeing as loading the page does mean history is created and traversed to, yes, it should be fired on page load.

Also see,

http://www.mail-archive.com/whatwg@lists.whatwg.org/msg19722.html

and,

https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

这篇关于页面加载时HTML5 onpopstate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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