Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 453
Andrey Avatar asked Nov 24 '22 18:11

Andrey


1 Answers

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.

like image 195
Jay McVety Avatar answered Nov 27 '22 06:11

Jay McVety