Prevent event binded to object from being overridden - Javascript DOM

Javascript examples for DOM:Event

Description

Prevent event binded to object from being overridden

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from   w  w  w  .  j ava2s .  com*/
window.addEventListener('beforeunload', function (e) {
    e.stopImmediatePropagation();
    console.log('A')
});
window.addEventListener('beforeunload', function (e) {
    e.stopImmediatePropagation();
    console.log('B')
});
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials