Javascript examples for DOM Event:Element Event Attribute
The onpagehide event occurs when the user is navigating away from a webpage.
Bubbles | No |
---|---|
Cancelable | No |
Event type: | PageTransitionEvent |
Supported HTML tags: | <body> |
<!DOCTYPE html> <html> <body> <h1 id="demo"></h1> <script> document.getElementsByTagName("BODY")[0].onpagehide = function() {myFunction()}; function myFunction() {/*from w w w . j a v a 2 s . c o m*/ document.getElementById("demo").innerHTML = "Welcome To My Homepage!"; }; </script> </body> </html>