What is the usage of onunload event in JavaScript?

The unload event trigger when you unload (or refresh) a page. You can try to run the following code to learn how to implement onunload event in JavaScript.

Example


   
      

Close the page and see what happens!

     

This event may give unexpected results.

         
Updated on: 2020-05-21T07:51:06+05:30

403 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements