SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
 <head>
  <meta charset="UTF-8">
  <title>测试</title>
  <script>
    function checkLeave(){
      event.returnValue="确定离开当前页面吗?";
    }
   </script>
 </head>
 <body onbeforeunload="checkLeave()">
  测试
 </body>
</html>