Skip to content Skip to sidebar Skip to footer

Get Content Of Some File In Firefox Sdk Main.js

So I'm developing a Firefox addon that adds a bit of HTML to the DOM of any webpage. The idea here is that I'm using a file called template.html as a template, that is located in t

Solution 1:

myAddon/lib/main.js:

var template = require("sdk/self").data.load("template.html"); // This is where I want to fetch the contents of template.html.

pageMod.PageMod({
    include: "*", // Apply script at any page
    contentScriptFile: [data.url("jquery-1.11.2.min.js"), data.url("main.js")], // Include jQuery and myAddon/data/main.js
    contentScriptOptions: {
      template: template
    }
});

myAddon/data/main.js

var template = self.options.template;

Post a Comment for "Get Content Of Some File In Firefox Sdk Main.js"