[Greasemonkey] adding a "global" javascript function

Ilia K. mail4ilia at gmail.com
Wed Oct 12 22:41:53 EDT 2005


Hi, All!

There are lots of nasty (read IE only) sites all over the world. Today
I've faced the need to surf one of them. This sites uses
window.navigate() call for almost every link, but Firefox doesn't
support this method. I think I can fix it by adding my own function,
like this:

window.navigate = function(url) {
    window.location.href=url;
}

If I do it on the local html page, it works, but when I try to make
the same through greasemonkey script it has no result. The following
example from the DiGM (
http://diveintogreasemonkey.org/helloworld/code.html ) doesn't work
too:

window.helloworld = function() {
    alert('Hello world!');
}
window.setTimeout("helloworld()", 60);

So, I guess something has changed in the new Greasemonkey. I use
Firefox 1.5beta1 with greasemonkey 0.6.2. What's the right way for me
to implement such a "global" function?

Thank you.
Ilia.


More information about the Greasemonkey mailing list