inject script in all iframes


stefanvd

Recommended Posts

Hello,

Any idea, trick... how I can inject to all

Current I have this code in my content script. But inject it only in current page, and not in the iframe element.

var rt = window.external.mxGetRuntime();

var browser = rt.create('mx.browser');

browser.injectScriptFile("js/theme.js");

Thanks,

Stefan

Link to comment
Share on other sites

stefanvd replied at 2014-1-24 11:19 back.gif

I did that -> doesn't work.

I want this javascript file be injected when i run this code, but in al ...

You must change your def.json file

"actions": ,

OR

"include": ,

"entryPoints": OR "doc_end", OR "doc_onload"],

"includeFrames": true,

"js": OR "your.js"]

}

Link to comment
Share on other sites

That work, but then the script start when I open the Maxthon browser.

example want I need:

In the def.json there is a content script (example "js/content.js"). When I open the Maxthon browser, it will add an extra button on a website. But when I click on that button, it must inject a new script ("theme.js").

I used this code

var rt = window.external.mxGetRuntime();

var browser = rt.create('mx.browser');

browser.injectScriptFile("js/theme.js");

But that inject only on the TOP of that website. And I want everything (in all the

Thanks,

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.