Horje

How to Execute a JavaScript when a user navigates to a webpage - HTML onpageshow Attribute

It Executes a JavaScript when a user navigates to a webpage.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body onpageshow="myFunction()">

<h1>Hello World!</h1>

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

</body>
</html>

Output should be:

How to Execute a JavaScript when a user navigates to a webpage - HTML onpageshow Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin