I’m making a Firefox add-on using the Add-on SDK. I can’t find a way to use JavaScript code in a panel. Here is what I’ve done:
//file main.js
data = require("self").data
var MeteoPanel = require("panel").Panel({
width:740,
height:350,
contentURL: data.url("test.html"),
allow:true
});
require("widget").Widget({
id: "open-meteo-btn",
label: "Meteo",
contentURL: data.url("icon.png"),
panel: MeteoPanel
});
This works but I can’t use JavaScript in the test.html page.
Does someone have a solution?
Try putting the js in a separate file, and then:
Seems like
contentScriptFileaccepts an array too, so you could change its value to[data.url("file1.js"),data.url("file2.js")]if you need for instance to add 2 source files.