Why does onbeforeunload event not work - Stack Overflow
漂亮男人
漂亮男人 2017-05-19 10:24:05
0
3
744

Why is the beforeunload event not triggered when the page window is closed? How to solve this?

漂亮男人
漂亮男人

reply all(3)
洪涛

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template