问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/4807622/setting-img-src-to-a-data-url-via-work-does-not-work-in-ie8