search

Home  >  Q&A  >  body text

Why does onbeforeunload event not work - Stack Overflow

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

漂亮男人漂亮男人2808 days ago790

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:26:05

    https://developer.mozilla.org...

    The alert in this event will be ignored

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-19 10:26:05

    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

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-19 10:26:05

    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.

    reply
    0
  • Cancelreply