onunload event trigger

When we exit a page or close the browser tab we can trigger an event by using onunload . However when we close the browser then it can't be displayed. To check this code open the demo page in one new tab and then try to close the tab or visit to a different URL to exit the page. The source code of the demo page is here.

Here is the demo of onunload event

The source code of the demo page is here.
This will work on Firefox and Internet Explorer borwer

<!doctype html public "-//w3c//dtd html 3.2//en">

<html>
<head>
<title>Demo of onunload event trigger</title>
</head>
<body onunload="alert('thanks for visiting plus2net')";>
You should get one alert message when you close this page or exit this page. 

</body>
</html>

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer