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>