浏览器关闭事件而非页面刷新/重新加载事件 [英] browser close event not page refresh/reload event
本文介绍了浏览器关闭事件而非页面刷新/重新加载事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只需要检测浏览器关闭事件,而不是页面刷新/重新加载事件
i need to detect the browser close event only not page refresh/reload event
我已经尝试过了,但是在两种情况下都可以正常工作
I have tried this , but in both condition its working
$(window).bind('beforeunload',function(){
});
window.onbeforeunload = function (e) {
}
$(window).unload(function() {
});
推荐答案
没有捕获浏览器Close Event
的特定方法.
There is no specific method for capturing browser Close Event
.
您只能在当前页面的unload
上捕获.
You can only capture on unload
of the current page.
当您尝试refresh
或reload
页面时,这也可以使用.
Which also works when you try to refresh
or reload
the page.
这篇关于浏览器关闭事件而非页面刷新/重新加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文