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

None.

Syntax

<element onpageshow="script or Javascript function">

Supported Tags

<body>




Browser compatibility

onpageshow Yes 11.0 Yes Yes Yes

Example

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

<script>
function myFunction() {
    alert("hi!");
}
</script>

</body>
</html>

Click to view the demo