确定要离开当前页面吗

 1 <html xmlns="[url]http://www.w3.org/1999/xhtml[/url]">
 2    <head>
 3    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 4    <title>onbeforeunload测试</title>
 5    <script>
 6    function checkLeave(){
 7          event.returnValue="";
 8    }
 9    </script>
10    </head>
11    <body onbeforeunload="checkLeave()">
12    </body>
13    </html>
原文地址:https://www.cnblogs.com/lyghost/p/2581949.html