Call event.stopImmediatePropagation() to stop event - Javascript DOM

Javascript examples for DOM:Event

Description

Call event.stopImmediatePropagation() to stop event

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 .jav  a 2s .  co m*/
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