Detect if an alert or confirm is displayed on a page
If you wanted to run some code when an alert() fires, you could try something like this: I’ve only tested in Chrome, so I’m not sure about browser support. Example: http://jsfiddle.net/Q785x/1/ (function() { var _old_alert = window.alert; window.alert = function() { // run some code when the alert pops up document.body.innerHTML += “<br>alerting”; _old_alert.apply(window,arguments); // … Read more