Html IE6:如何让内联 base64 图像与 IE6 一起使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1575333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IE6: How to get inline base64 images to work with IE6?
提问by Jacob
How do I get IE6 to display inline base64 encoded images?
如何让 IE6 显示内联 base64 编码图像?
<img src="data:image/png;base64,....." />
This works in Firefox/Chrome/Safari but not IE6.
这适用于 Firefox/Chrome/Safari,但不适用于 IE6。
回答by presario1216
My solution run smoothly on IE6. It may help you!
我的解决方案在 IE6 上运行流畅。它可能会帮助你!
<!--
Content-Type: multipart/related; boundary="=_data-uri"
-->
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#pic {
width:670px;height:710px;
background-image: expression("url(mhtml:" + window.location + "!locoloco)");
}
</style>
</head>
<body>
<div id="pic" ></div>
<div id=test style="display: none;">
--=_data-uri
Content-Location:locoloco
Content-Transfer-Encoding:base64
iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8 /w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
--=_data-uri--
</div>
</body>
</html>
回答by Cullen Walsh
Install Google's Chrome Frame?
安装谷歌的 Chrome 框架?
Seriously, you can't. IE6 does not have support for base64 inline images.
说真的,你不能。IE6 不支持 base64 内嵌图像。
回答by Barney
IE6 needs an expression to correctly interpret base 64 encoded images. Dean Edwards describes the solution here: http://dean.edwards.name/weblog/2005/06/base64-sexy/
IE6 需要一个表达式来正确解释 base 64 编码的图像。Dean Edwards 在这里描述了解决方案:http: //dean.edwards.name/weblog/2005/06/base64-sexy/
Note: this is a very ugly hack. In the first place we were putting image code in our CSS; with this solution you need to either put presentational data in Javascript, or behavioural data in your CSS. Nasty but necessary.
注意:这是一个非常丑陋的黑客。首先,我们将图像代码放入 CSS 中;使用此解决方案,您需要将展示数据放入 Javascript,或将行为数据放入 CSS。讨厌但必要。
回答by Makarand Mane
base64 images are showing up in IE6 and IE7... in the last i found a simple solution when you are using a encoded images in css.
base64 图像显示在 IE6 和 IE7 中...最后我找到了一个简单的解决方案,当您在 css 中使用编码图像时。
"write two attributes in a same class. Use css browser specific hacks"
“在同一个类中编写两个属性。使用 css 浏览器特定的技巧”
I am going to explain it below.
我将在下面解释它。
<div class="myClass"> </div>
<style>
.myClass{
background=url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAHCAYAAADam2dgAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAySURBVHjaYlSdd/4/AwQwQml0PgMTHsn/yIoYCCmEKcKrEFkRTrcxEVIAs46g7wACDACraA+g90OOjwAAAABJRU5ErkJggg%3D%3D');
/* Above property will work for all browsers*/
*background=url('give real path_to_image');
/* This will work only for ie6 and ie7 */
}
</style>
回答by Misha Reyzlin
You can use base64 in CSS, at least. Please take a look: http://www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/
您至少可以在 CSS 中使用 base64。请看一看:http: //www.phpied.com/mhtml-when-you-need-data-uris-in-ie7-and-under/
Perhaps more research could possible help using mhtml:// for inline images, too.
也许更多的研究也可能有助于将 mhtml:// 用于内嵌图像。
回答by Misha Reyzlin
If this isn't for a corporate setting, I'd say just drop IE6 support all together, and have people install Chrome Frameif they insist on using such an outdated browser.
如果这不是用于公司设置,我会说只是一起放弃对 IE6 的支持,如果人们坚持使用这种过时的浏览器,请让他们安装Chrome Frame。
回答by Ken Pega
This could be a quick fix to make Base64 images showing up in IE6 again:
这可能是使 Base64 图像再次显示在 IE6 中的快速修复:
Base64 image fix for Internet Explorer
Internet Explorer 的 Base64 图像修复
*Sorry for the broken link, now comes the correct one!
*抱歉链接断开,现在是正确的链接!
I think this is a non-intrusive way to make things working again. It actually repair the images after you have those broken images (broken icon) already displayed on IE.
我认为这是一种让事情重新工作的非侵入性方式。在 IE 上已经显示了那些损坏的图像(损坏的图标)后,它实际上会修复图像。
回答by mimetnet
ORGINAL
原版
I do not believe IE6 supports in-line data for the <img/>
tag. However, you might want to try another format like GIF or JPG.
我不相信 IE6 支持<img/>
标签的内嵌数据。但是,您可能想尝试其他格式,如 GIF 或 JPG。
EDITGiven the fact that it took IE forever to accurately support PNG (still debatable) one could easily deduce that PNG might not be supported as an in-line data format for <img/>
tags. With that said, goto **ORIGINAL**
编辑考虑到 IE 永远准确地支持 PNG(仍有争议)这一事实,人们可以很容易地推断出 PNG 可能不被支持作为<img/>
标签的内嵌数据格式。话虽如此,转到**ORIGINAL**