What is the usage of onpageshow event in JavaScript?

HTMLJavascriptProgramming Scripts

The onpageshow event triggers in JavaScript when a user reaches the new web page.

Example

You can try to run the following code to learn how to implement onpageshow event in JavaScript.

<!DOCTYPE html>
<html>
   <body onpageshow = "newFunc()">
      <p>On first visit, a welcome message is visible.</p>
      <script>
         function newFunc() {
            alert("Welcome!");
         }
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 15:18:42
Advertisements