views:

59

answers:

1

Hey, I would like to use an image in firefox extension I am developing. Can someone tell me how to include the image. I used the following but it did not work.

 var divTag = content.document.createElement("img");     
 divTag.id = "div1";
 divTag.src="chrome://ff_extension/content/image1.gif";
 divTag.setAttribute("align","center");
 divTag.style.margin = "0px auto";
 divTag.style.position="fixed";
 divTag.style.bottom="0px";
 divTag.style.height="22px";
        divTag.style.width="100%";
            content.document.getElementsByTagName('body')[0].appendChild(divTag);

Thanks.

A: 

Can't you just use the relative path?

divTag.src="image1.gif";

I just looked at some plugins i have installed and they use the same chrome:// syntax you used.

  • Did you double check your the file path?
  • Are you positive you can embed a gif? It would be ridiculous if you couldn't but it's worth double checking. All I see being used are png's.
Brian Gianforcaro