- <html>
- <head>
- <title>测试浏览器关闭事件</title>
- </head>
- <body>
- <script type='text/javascript'>
- <!--
- window.onbeforeunload = function() {
- alert("捕获onbeforeunload事件成功");
- return "确认要放弃此问题吗?";
- };
- //-->
- </script>
- 测试浏览器关闭事件
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/231020136616.html
来源: http://www.codesnippet.cn/detail/231020136616.html