title: Javascript alert: block if message contains certain word?
body: <p>I have a webapp that makes calls to a database. Every once in a while, we get a javascript alert dialog that says that the transaction was deadlocked. Honestly, we don't care if that happens because it's not an interactive app...it just displays data based on a timer and if it misses it this time, it's okay to display it next time around.</p>
  
  <p>I know you can over write the alert method like so:</p>
  
  <pre><code>window.alert = function alert(msg) {
    console.log('Hidden Alert ' + msg);
  };
  </code></pre>
  
  <p>(found at <a href="https://stackoverflow.com/questions/2963677/can-i-prevent-an-alert-with-a-google-chrome-extension">Can I prevent an alert() with a Google Chrome Extension</a>)</p>
  
  <p>The question I have is: <em>Is there a way to see if the message for the alert <code>.contains</code>a specific word or phrase, ignore the alert call if it does but display the alert otherwise?</em> Installing an extension to deal with this really isn't an option. </p>
  
  <p>Clarification:</p>
  
  <p>I know how to catch it if it does or doesn't but what code would I write to go ahead and display the alert like normal if I'm over writing the alert code?</p>