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

问题描述

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



哪一个是正确的行为?

解决方案



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



另请参阅,






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?

解决方案

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 13:22
查看更多