Horje

How to add a JavaScript when a user navigates to a webpage

See the code.

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 add a JavaScript when a user navigates to a webpage




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Window Event Attributes
Uploaded by:
Admin