Wednesday, February 14, 2018

the onhashchange event gets tripped whenever you change a part of the URL after the hash tag/pound sign/numbers symbol

<!DOCTYPE html>
   <head>
      <title>Whatever</title>
      <script>
         function whatever() {
            alert("Got it!");
         }
      </script>
   </head>
   <body onhashchange="whatever()">
   </body>
</html>

 
 

onbeforeunload will get called if you close the browser or change the URL entirely, navigating away. So far I can only get this to work in IE, not Google Chrome.

No comments:

Post a Comment