Javascript examples for DOM Event:onbeforeunload
Handle window onbeforeunload function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w .j a v a 2 s . com*/ var popWindow = true; window.onbeforeunload = function() { if(popWindow == true) { popWindow = false; return "Sure?"; } } } </script> </head> <body> </body> </html>