为什么jQuery卸载不能用于chrome和safari? [英] Why is jQuery unload not working in chrome and safari?

查看:110
本文介绍了为什么jQuery卸载不能用于chrome和safari?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

卸载功能在Firefox中运行良好,但在chrome和safari中运行不正常。请在Chrome和Firefox中查看这个小提琴。 http://jsfiddle.net/jeevankk/Gywnw/2/ 。在页面刷新时提醒消息。

unload function in jQuery works fine in Firefox but not in chrome and safari. please check this fiddle in chrome and Firefox. http://jsfiddle.net/jeevankk/Gywnw/2/ . Alerts a message when the page is refreshed.

$(window).unload(function() {  
        alert("Unload");  
});​  


推荐答案

<我发现约瑟夫的评论是正确答案,所以发布这个答案。

I found Joseph's comment as the correct answer, So posting this answer.

在beforeunload期间阻止/阻止对话框(除了beforeunload提示)和卸载事件。可以通过检查您的控制台来确认。

Dialogs are blocked/prevented during "beforeunload" (with exception to the beforeunload prompt) and "unload" events. Can be confirmed by checking your console.

这篇关于为什么jQuery卸载不能用于chrome和safari?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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