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