We are developing an add-in, and would like to have the content script being injected into the top page and all frames. However we found that the content scripts cannot be injected into iframe with src as "about:blank" or "javascript:...".
Any comment/suggestion?
sample page-mod:
require("sdk/page-mod").PageMod({
include:["*", "file://*"],
contentScriptFile: [
"./content/content.js",
],
attachTo: ["existing","top", "frame"],...
I want to update an interesting fact that detected by my teammate Wayland:
The funny thing is that it will work if we build the iframe as following:
It's like if we flush by iframe content by calling 'document.write'.
function buildme() {
var iframe = ...;
iframe.contentDocument.open();
iframe.contentDocument.write("<html><body></body></html>");
iframe.contentDocument.close()
var child = iframe.contentDocument.craeteElement("..");
...
iframe.contentDocument.body.appendChild(child);
}
< iframe id = "myframe"
onload = "buildme();" / >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With