How can i add javascript files into an existing web page with firefox add on sdk -


i toying around firefox sdk add on right now, , want add javascript files existing website - adding jquery existing website.

how do that?

there solutions that. 1 example following:

var tabs = require("sdk/tabs"); var data = require("sdk/self").data;  tabs.on('ready', function(tab) {     var worker = tabs.activetab.attach({         contentscriptfile: [             data.url("jquery.min.js")         ]     });  }); 

where jquery.min.js in data folder of extension , attached active tab.

one other solution use pagemod allow determine in web pages js attached. in following example attached mozilla.org.:

var data = require("sdk/self").data; var pagemod = require("sdk/page-mod");  pagemod.pagemod({   include: "*.mozilla.org",   contentscriptfile: data.url("my-script.js") }); 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -