[Greasemonkey] Can anybody explain the namespace rules to me?
Linan Wang
tali.wang at gmail.com
Tue Jun 6 02:56:14 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');
alink.innerHTML='A link';
alink.href='javascript:self_defined_function()';
document.body.appendChild(alink);
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