2

When I attempt to set an image to use a data url via JavaScript (from this question), it does not appear to work in IE8.

The page in that first link has: <img id="foo" src="alphaball.png">
On line 25, this JavaScript code executes: document.getElementById('foo').src = img_src;

On all other browsers (including IE9b) this successfully changes the image from the alphaball to a picture of my head. On IE8, I see the alphaball very briefly, and then it is replaced with a missing image icon.

Is this a known issue? Is there a workaround for using data urls with IE8 and JavaScript?

Community
  • 1
  • 1
Phrogz
  • 296,393
  • 112
  • 651
  • 745

1 Answers1

4

Internet Explorer versions before 9 do not support data URLs. There's an alternative mechanism that apparently kind-of works.

edit — actually I'm wrong; IE8 will support them as long as they're less than 32KB.

edit again — ok I found the article I was thinking about concerning the "MHTML" thing from Microsoft.

Pointy
  • 405,095
  • 59
  • 585
  • 614
  • Ah, silly me. I forgot about the 32kB limit, and the data in that example appears to be slightly over. Thanks! – Phrogz Jan 26 '11 at 17:39
  • Thanks for the pointer to the article on phpied.com :) I am trying to replicate what the article describes, but using inline CSS instead of an external CSS file. However, I cannot make it work :( I have opened a question about it here: http://stackoverflow.com/questions/29280977/inline-images-in-html-for-ie8 – AsGoodAsItGets Mar 26 '15 at 15:04