Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

HTML onpageshow Event Attribute

❮ HTML Event Attributes

Example

Execute a JavaScript when a user navigates to a webpage:

<body onpageshow="myFunction()">
Try it Yourself »

Definition and Usage

The onpageshow event occurs when a user navigates to a webpage.

The onpageshow event is similar to the onload event, except that it occurs after the onload event when the page first loads. Also, the onpageshow event occurs every time the page is loaded, whereas the onload event does not occur when the page is loaded from the cache.


Browser Support

The numbers in the table specify the first browser version that fully supports the event attribute.

Event Attribute
onpageshow Yes 11.0 Yes 5.0 Yes

Syntax

<element onpageshow="script">

Attribute Values

Value Description
script The script to be run on onpageshow

Technical Details

Supported HTML tags: <body>

Related Pages

HTML DOM reference: onpageshow event


❮ HTML Event Attributes