stefanvd Posted January 23, 2014 Report Share Posted January 23, 2014 Hello, Any idea, trick... how I can inject to all objects in the current webpage? 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 More sharing options...
大笨狗 Posted January 23, 2014 Report Share Posted January 23, 2014 In def.json, change actions/includeFrames from false to true. Link to comment Share on other sites More sharing options...
stefanvd Posted January 24, 2014 Author Report Share Posted January 24, 2014 I did that -> doesn't work. I want this javascript file be injected when i run this code, but in all elements on a web page. Link to comment Share on other sites More sharing options...
Positronis Posted January 26, 2014 Report Share Posted January 26, 2014 stefanvd replied at 2014-1-24 11:19 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 More sharing options...
stefanvd Posted January 26, 2014 Author Report Share Posted January 26, 2014 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 elements) Thanks, Link to comment Share on other sites More sharing options...
Positronis Posted January 26, 2014 Report Share Posted January 26, 2014 stefanvd replied at 2014-1-26 12:12 That work, but then the script start when I open the Maxthon browser. example want I need: Check you *.js file and if you have if(unsafeWindow.top == unsafeWindow.self) it don't runs on frames or iframes] remove it and try how it work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.