Embedding (Local) Javsascript with Firefox Addon...
I have a .js which I want my Firefox addon to embed into a page.
I've tried the below but it's not working:
Code:
var script = window.content.document.createElement("script");
script.setAttribute("src", "chrome://file.js");
script.setAttribute("type", "text/javascript");
script.onload = function() {
// Onload script load events
}
window.content.document.body.appendChild(script);
Anyone got any ideas?
Note:
I can't just run the .js "on the addon" so to speak because it includes references like "document.body" which when you write on an addon are "window.content.document.body", etc.
Is there a way around this?