CSS Portal
Run
Search
« Back to
HTML onbeforeunload Event Attribute
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Event attribute onbeforeunload</title> </head> <body onbeforeunload="myFunction()"> <p>Close this window, press F5 or click on the link below to trigger an event for onbeforeunload.</p> <a href="https://www.cssportal.com">Go to CSSPortal.com</a> <script> function myFunction() { return "Are you sure you want to leave this page?"; } </script> </body> </html>
If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!
☕ Buy a Coffee