- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 away from a page in HTML?
When the user navigates from a page, the onpagehide attribute triggers. The navigation occurs when a user clicks a link, closes the browser tab, submits a form, etc.
To execute it, try −
<p onpagehide = "myScript">
You can also use,
object.onpagehide = function(){script};
Advertisements
To Continue Learning Please Login
Login with Google