在Safari 9中按“后退"按钮后触发JQuery/Javascript [英] Fire JQuery/ Javascript after Back Button in Safari 9
本文介绍了在Safari 9中按“后退"按钮后触发JQuery/Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用Chrome/Firefox中的浏览器后退"按钮向后导航时,我的网站可以正常运行(与不加载后退导航的情况一样).
When I navigate back using the browser back button in Chrome/ Firefox my website works just as expected (the same as it would if loaded without navigating backward).
在Safari中导航后,无论标准文档准备就绪还是在StackOverflow上找到一些骇客解决方法,我都无法触发任何加载"类型的事件.我没有做任何特别的事情,我只需要打电话:
In Safari after navigating back I can't get any 'on load' type event to fire whether the standard document ready or some hackaround found on here on StackOverflow. I'm not doing anything special, I just really need to call:
$( document ).ready(function() {
// analyticsEvent();
// startAnimation();
// etc();
});
有人遇到过同样的问题吗?
Has anyone encountered the same problem?
推荐答案
尝试一下
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
window.location.reload()
}
});
这篇关于在Safari 9中按“后退"按钮后触发JQuery/Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文