HTML | onpageshow Event Attribute
This event occurs when a user navigates to a website. This event is quite similar to onload event but it occurs after the onload event. It occurs every time when the page is loaded whereas the onload event does not occur when the page is loaded from cache.
Syntax:
<element onpageshow = "script">
This event contains single attribute script. The script is to be run on onpageshow event. This event is used with in body tag.
Example:
<!DOCTYPE html> <html> <head> <title>onpageshow event</title> </head> <body onpageshow="Geeks()"> <h1 style="color:green;text-align:center;">GeeksForGeeks</h1> <script> function Geeks() { alert("Welcome to GeeksForGeeks!"); } </script> </body> </html> |
Output:

Supported Browsers: The browser supported by onpageshow Event Attribute are listed below:
- Apple Safari 5.0 and above
- Google Chrome
- Firefox
- Opera
- Internet Explorer 11.0 and above
Recommended Posts:
- HTML | DOM onpageshow Event
- HTML | onkeyup Event Attribute
- HTML | ondrop Event Attribute
- HTML | onresize Event Attribute
- HTML | ontoggle Event Attribute
- HTML | onhashchange Event Attribute
- HTML | onmouseover Event Attribute
- HTML | ondragstart Event Attribute
- HTML | onkeydown Event Attribute
- HTML | oninvalid Event Attribute
- HTML | ononline Event Attribute
- HTML | onsubmit Event Attribute
- HTML | onclick Event Attribute
- HTML | onmouseout Event Attribute
- HTML | onreset Event Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



