js 监控浏览器关闭事件

时间:2019-12-03 20:09:27   收藏:0   阅读:175
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>监控浏览器关闭事件</title>
  5. </head>
  6. <style type="text/css">
  7. </style>
  8. <body>
  9. <div id="create_order">
  10. </div>
  11. </body>
  12. </html>
  13. <script type="text/javascript">
  14. var widowClose = {};
  15. widowClose.tip = "浏览器即将关闭,是否确定??";
  16. widowClose.set = function(a) {
  17. window.onbeforeunload = function(b) {
  18. b = b || window.event;
  19. b.returnValue = a;
  20. return a
  21. }
  22. };
  23. widowClose.clear = function() {
  24. fckDraft.delDraftById();
  25. window.onbeforeunload = function() {
  26. }
  27. };
  28. widowClose.set(widowClose.tip);
  29. </script>

 

原文:https://www.cnblogs.com/nxmxl/p/11978632.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!