<!DOCTYPE html>
<html>
<head>
<script>
  function closeIt()
  {
    return confirm("确定退出吗");
} window.onbeforeunload = closeIt; </script> </head> <body> <a href="http://www.jb51.net">Click here to navigate to www.jb51.net</a> </body> </html>

兼容FF,IE,Chrome的js离开或刷新页面检测,关键的部分是要有return

相关文章:

  • 2021-12-06
  • 2021-10-15
  • 2021-10-02
  • 2021-08-17
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-28
  • 2021-10-11
  • 2022-01-02
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案