通过Jquery检测关闭窗口事件 [英] Detect Close windows event by Jquery

查看:540
本文介绍了通过Jquery检测关闭窗口事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否通过jquery为我提供检测所有浏览器仅关闭窗口关闭事件的最佳方法?

Could you please give me the best way to detect only window close event for all browsers by jquery?

我的意思是点击浏览器或window.close()上的X按钮,不代表F5,表单提交,
window.location或链接。
我正在寻找许多线程,但没有找到正确的方法。

I mean clicking X button on the browser or window.close(), not meaning F5, form submission, window.location or link. I were looking for many threads but have not found the right way.

非常感谢您的支持。

推荐答案

没有捕获浏览器关闭事件的特定事件。

There is no specific event for capturing browser close event.

你只能在卸载当前页面时捕获。

You can only capture on unload of the current page.

通过这种方法,它将在刷新/导航当前页面。

By this method, it will be effected while refreshing / navigating the current page.

即使计算鼠标事件的XY位置也不会给你带来好的结果。

Even calculating of X Y postion of the mouse event doesn't give you good result.

这篇关于通过Jquery检测关闭窗口事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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