简体   繁体   中英

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).

From the Safari documentation :

unload Deprecated, use pagehide instead.

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! Found info here and here as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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