HTML event attribute onpageshow

The onpageshow attribute event is trigger when browser starts to show a web page.

The onpageshow event occurs after the onload event when the page first loads.

The onpageshow event occurs every time the page is loaded. The onload event does not occur when the page is loaded from the cache.

What's new in HTML5



<element onpageshow="script or Javascript function">

Supported Tags


Browser compatibility

onpageshow Yes 11.0 Yes Yes Yes


<!DOCTYPE html>
<body onpageshow="myFunction()">
<!--  ww w  .j  ava2s  .c om-->
<h1>Hello World!</h1>

function myFunction() {


Click to view the demo