Images with file:/// src attribute not displaying in IE7
Posted on 2007-08-06
I have a plug-in for Internet Explorer that displays images in certain web pages. To save bandwidth, the image is stored locally (distributed with the plug-in). I dynamically write an img tag with the src attribute set to file:///x:/path/to/image.gif. This works fine in IE6, but in IE7 all I get is the image placeholder. It's not a broken image, it's just like it's refusing to load the image entirely.
Am I doing something wrong? The element I'm writing looks like this:
<IMG src="file:///C:/Documents%20and%20Settings/Nathan/Application%20Data/IEPlugin/skin/image.gif" border=0>
The code to insert it looks like this:
var image = doc.createElement('img'); image.setAttribute('src', getIconURL()); image.setAttribute('border', '0'); target.appendChild(image);
getIconURL just does some magic to find the current user's application data folder and then returns the url you see above (or whatever URL is appropriate for the current user's computer, of course).