开发者

How do i alter the content of an iframe in the dom using firefox extension code?

开发者 https://www.devze.com 2023-01-15 01:23 出处:网络
I would like to alter the page shown in my br开发者_运维技巧owser using a firefox extension (add-on) i wrote.

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;
    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消