Safari< body onload>事件不会从“后退"按钮触发 [英] Safari <body onload> event doesn't trigger from the back button

查看:136
本文介绍了Safari< body onload>事件不会从“后退"按钮触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当通过后退按钮进入页面时,似乎无法在Safari中触发body onload ="..."事件.它在FF和IE中工作正常.有Javascript或jQuery解决方案吗?

I don't seem to be able to get the body onload="..." event to fire in Safari when the page is entered via the back button. It works fine in FF and IE. Is there a Javascript or jQuery solution?

任何帮助表示赞赏.

推荐答案

尝试:

window.addEventListener("pageshow", function() {
  alert('page shown');
}, false);

对于 Opera 浏览器,请阅读以下内容: http://samuli.hakoniemi.net/onload-issues-with-opera/

For Opera browser, read this: http://samuli.hakoniemi.net/onload-issues-with-opera/

这篇关于Safari< body onload>事件不会从“后退"按钮触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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