Javascript examples for Browser Object Model:Window open
Open popup before closing the current tab
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w . j a v a2s. c om*/ var popWindow = true; window.onbeforeunload = function() { if(popWindow == true) { popWindow = false; return "Sure?"; } } } </script> </head> <body> </body> </html>