Execute a JavaScript when a user navigates to a webpage: - Javascript DOM Event

Javascript examples for DOM Event:onpageshow

Description

Execute a JavaScript when a user navigates to a webpage:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body onpageshow="myFunction()">

<h1>Hello World!</h1>

<script>
function myFunction() {// w  w  w  . ja va 2 s.co m
    console.log("Welcome!");
}
</script>

</body>
</html>

Related Tutorials