I am currently developing a Firefox extension using the Add-On SDK and am facing a real problem. Basically, my extension simply injects the script content into a web page as follows:
main.js
var pageMod = require("page-mod"); var self = require("self"); pageMod.PageMod({ include: "http://mail.google.com/mail/*", contentScriptFile: [self.data.url("jquery.js"), self.data.url("start.js")], attachTo : ["top"] });
start.js
$('body').append('<div>1</div><img src="insertnote.png" /><div>2</div>');
Both start.js and insertnote.png are in the data folder. Everything works except for the image. I just couldn't find how to get the real url for the image tag. Relative URL not working .: (
Is it possible to include internal addon images inside content scripts or just use absolute URLs for my web server?
Kir Ivlev
source share