firefox extension load javascript file
I have a firefox extension and I loaded an external javascript file to access some file writing functions. It works on Windows Vista but not on Windows 7. My code for loading the javascript file is this:
onLoad: function() {
// initialization code
this.initialized = true;
this.strings = document.getElementById("bs-strings");
var service = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);service.loadSubScript("chrome://global/content/writefunc.js");
},
I tried to find the path were my extension is saved under Windows 7 but could not find it. My guess is that Firefox plus extensions are installed differently under Windows 7 and I cannot find the file if I declare the pat开发者_如何学Goh like I did. Are there better ways to load javascript files in extension?
writefunc.js
is a file provided by you or by Firefox?
If by you, then the path has to point to your plugin:
chrome://<yourAddonNameHere>/content/writefunc.js
精彩评论