![]() |
Definition and UsageThe 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. Applies toThe onpageshow attribute is part of the Event Attributes, and can be used on the following element:
Browser SupportThe numbers in the table specify the first browser version that fully supports the event attribute. |
Example:
HTML
<!DOCTYPE html>
<html>
<body onpageshow="myFunction()">
<h1>Hello World!</h1>
<script>
function myFunction() {
alert("Welcome!");
}
</script>
</body>
</html>
html onpageshow attribute |
How to Execute a JavaScript when a user navigates to a webpage - HTML onpageshow Attribute | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 72 |
Reffered: https://www.w3schools.com/tags/att_onpageshow.asp