[Greasemonkey] adding a "global" javascript function
Lenny Domnitser
ldrhcp at gmail.com
Wed Oct 12 18:07:10 EDT 2005
On 10/12/05, Ilia K. <mail4ilia at gmail.com> wrote:
> window.helloworld = function() {
> ...
> So, I guess something has changed in the new Greasemonkey.
Yep. window is now an XPCNativeWrapper (it's a security thing) and
unsafeWindow is a new object that is the regular page window.
unsafeWindow.helloworld = function() {
alert('Hello world!');
}
Make sure not to use unsafeWindow on scripts that execute on unlimited
sites, because a malicious page can take advantage of unsafeWindow
(hence "unsafe") to do all sorts of bad things.
More information about the Greasemonkey
mailing list