How do i alter the content of an iframe in the dom using firefox extension code?
I would like to alter the page shown in my br开发者_运维技巧owser using a firefox extension (add-on) i wrote. I am able to get the page's iframes as XPCNativeWrapper object using:
iframes = window.content.document.getElementsByTagName('iframe')
for (var i = 0; i < iframes.length; i++) {
var elmInput = iframes[i];
Firebug.Console.log(elmInput);
}
But i haven't been able to get to the iframes content, not speaking of altering it.
How can i alter the content of an iframe in the dom?
I think you want elmInput.contentDocument
for (var i = 0; i < iframes.length; i++) {
var content = iframes[i].contentWindow.document.body.innerHTML;
...
}
精彩评论