I write code for Greasemonkey and I have an iframe without a src
in which I add code like this:
var appendToHead = function(iframe, content) {
var doc = iframe[0].contentWindow.document;
var element = doc.createElement('script');
element.type = 'text/javascript';
element.text = content;
doc.head.appendChild(element);
};
I see in Firebug that the function is added in the iframe. But when I try to get them, EG
frames[0].contentWindow.functionName
I get undefined
and still see them in debugger.
Before I used Greasemonkey this approach worked well. How can invoke these functions?