Detecting alerts with a Chrome extension - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window alert

Description

Detecting alerts with a Chrome extension

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(){/*  ww w  . j a  v a2s . c om*/

var native_alert = alert;
alert = function(msg) {
    console.log('call to console.log() - message: '+msg);
    native_alert(msg);
}
console.log('intercepted!');

    }

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

Related Tutorials