Code
Execute
<!DOCTYPE html> <html> <head> <title>html tutorial - html5 - html code - html form - In 30Sec by Microsoft Award MVP - | wikitechy HTML onbeforeunload Attribute</title> </head> <body onbeforeunload="return onBeforeUnload()"> <a href="http://www.wikitechy.com/">Click here to go to Wikitechy.com</a> <script> function onBeforeUnload() { return "Write something here..."; } </script> </body> </html>
Result