[Greasemonkey] Can anybody explain to me the strange namespace rule?
Linan Wang
tali.wang+maillist at gmail.com
Mon Jun 5 17:07:57 EDT 2006
I noticed that in greasemonkey scripts, to add a link in a page call a self
defined function, have to 'hook' the function into the unsafeWindow. For
example:
var alink=document.createElement('a');
a.innerHTML='A link';
a.href='javascript:self_defined_function()';
unsafeWindow.self_defined_function=function(){
another_function();
};
function another_function(){}
It is understandable, but in the 'self_defined_function', if i want to call
another function defined in userscript, that function should NOT be hooked
into unsafe. Why? Can anybody explain to me?
Many thanks!
Best regards
Linan Wang
More information about the Greasemonkey
mailing list