
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Execute a script when a user navigates to a page in HTML?
Use the onpageshow attribute to execute a script when a user navigates to a page.
Example
You can try to run the following code to implement onpageshow attribute −
<!DOCTYPE html> <html> <body onpageshow = "display()"> <h2>Tutorialspoint</h2> <p>Simply Easy Learning</p> <script> function display() { alert(You're back!"); } </script> </body> </html>
- Related Questions & Answers
- Execute a script when a user navigates away from a page in HTML?
- Execute a script when a page has unloaded in HTML?
- Execute a script when a user releases a key in HTML?
- Execute a script when a user is pressing a key in HTML?
- Execute a script when the element gets user input in HTML?
- Execute a script when the user writes something in a search field in HTML?
- Execute a script when the user pastes some content in an element in HTML?
- Execute a script when an error occurs in HTML?
- Execute a script when media data is loaded in HTML?
- Execute a script when the element is invalid in HTML?
- Execute a script when the element loses focus in HTML?
- Execute a script when the element gets focus in HTML?
- Execute a script when the file is unavailable in HTML?
- Execute a script when a Web Storage area is updated in HTML?
- Execute a script when a file is ready to start playing in HTML?
Advertisements