[Greasemonkey] kill an alert() popup from the script?

Lenny Domnitser ldrhcp at gmail.com
Wed Mar 1 15:00:26 EST 2006


You can overwrite alert to produce your own cancelable XUL window.
Rather than using unsafeWindow, use a wrapper, like so
(GM_executeContentScript in GM CVS does this):

open('javascript:(' + uneval(function() {
  window.alert = function() { /* ... */ };
  window.clearAlert = function() { /* ... */ }
}) + ')();', '_self');

Hope that helped start you off.


More information about the Greasemonkey mailing list