Open In App
Related Articles

HTML onpageshow Event Attribute

Improve Article
Improve
Save Article
Save
Like Article
Like

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 a single attribute script. The script is to be run on onpageshow event. This event is used within 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
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 04 Aug, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials