简体   繁体   English

检测移动浏览器关闭事件

[英]Detect Mobile Browser Close Event

Is there any way to detect mobile browser close event? 有没有办法检测移动浏览器关闭事件? I need to forcefully delete a cookie on browser close. 我需要在浏览器关闭时强制删除cookie。 I have already tried my luck with window.onbeforeunload and window.unload but they doesn't work for mobile browsers. 我已经尝试过window.onbeforeunloadwindow.unload但它们不适用于移动浏览器。 Search on the web a lot but didn't get any solution. 在网上搜索了很多,但没有得到任何解决方案。

Thanks in advance 提前致谢

I'm sorry but it's just impossible with Javascript... You can prevent the action of closing tab but not to do something when it will be close... 我很抱歉,但是Javascript只是不可能...你可以阻止关闭标签的动作但是当它关​​闭时不要做某事......

How to Detect Browser Window /Tab Close Event? 如何检测浏览器窗口/选项卡关闭事件?

对移动浏览器使用$(window).blur(function())。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM