本文介绍了通过工作将img src设置为数据网址在IE8中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过JavaScript 时 (来自),它似乎不适用于IE8。

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.

第一个链接中的页面包含:< img id =foosrc = alphaball.png>

在第25行,此JavaScript代码执行: document.getElementById('foo')。src = img_src;

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;

在所有其他浏览器(包括IE9b)上,这成功地将图像从alphaball更改为我的头像。在IE8上,我非常简短地看到alphaball,然后用一个丢失的图像图标替换它。

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.

这是一个已知的问题吗?是否有使用IE8和JavaScript的数据网址的解决方法?

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

推荐答案

9之前的Internet Explorer版本不支持数据URL。有一种替代机制显然是有效的。

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

编辑—其实我错了; IE8将支持它们,只要它们小于32KB。

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

再次编辑—好的我找到了文章我正在考虑关于微软的MHTML事件。

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

这篇关于通过工作将img src设置为数据网址在IE8中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 06:43