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

Lenny Domnitser ldrhcp at gmail.com
Thu Mar 2 09:39:30 EST 2006


On 3/2/06, Vectorspace <vectorspace at ntlworld.com> wrote:
> My javascript isn't that good, but I think I understand... You're using
> open() to execute a set of javascript instructions, as if you typed them
> into the address bar (like a bookmarklet).

Yes. That wrapper just executes the script as if it were a bookmarklet.

> I don't know what uneval() does

It just produce the Javascript source as a string. For example,
uneval('foo') == '"foo"'

I assumed that the alerts were coming from the web page. If only the
user script is producing the alerts, then you don't need that wrapper,
since you can just define a function in the Greasemonkey sandbox.

> The reason I use an alert popup is that it forces focus to the browser
> window and tab that spawned the alert, even if a non-Firefox window is
> active. And, if all browser windows are minimised, the taskbar icon for
> that window becomes highlighted. Will this still apply automatically, or
> will it be something I have to write? Because I don't know how to do that.

If that is the only thing you need, you can skip alert or custom
functions and just use window.focus.


More information about the Greasemonkey mailing list