Javascript examples for DOM Event:onbeforeunload
The onbeforeunload event occurs when the document is about to be unloaded.
Bubbles | No |
---|---|
Cancelable | Yes |
Supported HTML tags: | ?<body> |
<!DOCTYPE html> <html> <body onbeforeunload="return myFunction()"> <a href="https://www.java2s.com">Click here</a> <script> function myFunction() {//from w ww.ja v a 2s . c o m return "Write something clever here..."; } </script> </body> </html>