For this rare event, it’s best to use jquery to test. If jquery doesn’t support it, it means the compatibility is extremely poor. Let’s change our thinking
In IE6, IE7, IE8, it will be executed after refreshing the page, closing the browser, and after page jump;
IE9 will execute page refresh, but page jump and browser closing will not execute;
firefox (including firefox3.6) can be executed after closing the tag, after page jump, and after refreshing the page, but it cannot be executed after closing the browser;
Safari will be executed after refreshing the page and page jump, but it will not be executed after closing the browser;
Opera and Chrome will not be executed under any circumstances.
https://developer.mozilla.org...
The alert in this event will be ignored
For this rare event, it’s best to use jquery to test. If jquery doesn’t support it, it means the compatibility is extremely poor. Let’s change our thinking
Browser compatibility
In IE6, IE7, IE8, it will be executed after refreshing the page, closing the browser, and after page jump;
IE9 will execute page refresh, but page jump and browser closing will not execute;
firefox (including firefox3.6) can be executed after closing the tag, after page jump, and after refreshing the page, but it cannot be executed after closing the browser;
Safari will be executed after refreshing the page and page jump, but it will not be executed after closing the browser;
Opera and Chrome will not be executed under any circumstances.