Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML | onpageshow Event Attribute

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 16 Aug, 2022
Improve Article
Save Article

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.
Supported Tags: 

  • <body>

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: 
 

html




<!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
  • Google Chrome 3
  • Edge 12
  • Firefox 6
  • Opera 15
  • Internet Explorer 11

 

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!