
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
Execute a script when a page has unloaded in HTML?
The unloaded attribute triggers when a web page has unloaded. You can try to run the following code to implement unloaded attribute in HTML −
Example
<!DOCTYPE html> <html> <body onunload = "display()"> <h2>Tutorialspoint</h2> <h3>Simply Easy learning</h3> <script> function display() { alert("Bye!"); } </script> </body> </html>
- Related Articles
- Execute a script when the document is about to be unloaded in HTML?
- Execute a script when a user navigates to a page in HTML?
- How to execute the script when the page has finished parsing in HTML?
- Execute a script when a user navigates away from a page in HTML?
- Execute a script when the media has started playing in HTML?
- Execute a script when the media has reached the end of HTML?
- Execute a script when the playback position of the media has changed in HTML?
- Execute a script when an error occurs in HTML?
- Execute a script when a user releases a key in HTML?
- Execute a script when an element has been dragged to a valid drop target in HTML?
- Execute a script when the media has paused but is expected to resume in HTML?
- Execute a script when the file is unavailable in HTML?
- Execute a script when the element is invalid in HTML?
- Execute a script when the element loses focus in HTML?
- Execute a script when the element gets focus in HTML?

Advertisements