Andrey
Andrey

Reputation: 51

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

Upvotes: 5

Views: 4552

Answers (1)

Jay McVety
Jay McVety

Reputation: 196

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.

Upvotes: 1

Related Questions