简体   繁体   English

通过Mobile Safari中的JavaScript检测关闭浏览器选项卡?

[英]Detect closing browser tab via JavaScript in the Mobile Safari?

I need to obtain any event when user clicks the close button of the current browser tab. 当用户单击当前浏览器选项卡的关闭按钮时,我需要获取任何事件。 No one method which I use in such cases worked (for example onunload, unload and pagehide events handling not detection close tab, only change or update tab). 在这种情况下我没有使用任何方法(例如onunload,unload和pagehide事件处理不检测关闭选项卡,只更改或更新选项卡)。

From the Safari documentation : Safari文档

unload Deprecated, use pagehide instead. 卸载已弃用,请改用pagehide。

It looks like pagehide actually fires when you click on the "tabs" view to open a new page (see here in ghenne's answer) but other than that, no event even exists for closing browser on Mobile Safari! 它看起来像pagehide当您在“标签”视图中单击打开一个新页面(见实际上触发这里在ghenne的答案),但除此之外,任何情况下,即使存在对移动Safari浏览器关闭! Found info here and here as well. 在这里这里找到信息。

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

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