问题
I am trying to render an image in IE6
from a base64
encoded string. As per the resources here and here, I am trying out this following code (the image is just the base64
encoding of my profile pic here... :), obtained from this site)
<!--
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>
<script type = 'text/javascript'>
window.onload = function() { alert(window.location); }
</script>
</head>
<body>
<div>Foo</div>
<div id="pic" ></div>
<div id=test style="display: none;">
--=_data-uri
Content-Location:locoloco
Content-Transfer-Encoding:base64
/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPY3VydgAAAAAAAAAaAAAAywHJA2MFkghrC/YQPxVRGzQh8SmQMhg7kkYFUXdd7WtwegWJsZp8rGm/fdPD6TD////bAEMACAY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J3AS3L3K8oNYfuaDXMIK0svwiqAqcEs9fnmo222RTTFyE8C+oPFtO4KsQbiCNGWOmCcwg5jvFRFICArUrVTRmdo3HGabOp/9k=
--=_data-uri--
</div>
</body>
</html>
But when I run the page in IE6
, the image doesn't show up. Can anybody tell me what am I doing wrong, and how to fix it so that it shows up fine in IE6
? I am saving the file in my desktop and trying to open that in IE6
...
Update:
As per Musa's comment below, I changed the code to include the hack in the CSS only. Still not working:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
/*
Content-Type: multipart/related; boundary="=_data-uri"
--_
Content-Location:locoloco
Content-Type: image/png
Content-Transfer-Encoding:base64
/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAAABzAAAAEBkZXNjAAAAAAAAAANjMgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0ZXh0AAAAAEZCAABYWVogAAAAAAAA9tYAAQAAAADTLVhZWiAAAAAAAAADFgAAAzMAAAKkWFlaIAAAAAAAAG+iAAA49QAAA5BYWVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPY3VydgAAAAAAAAAaAAAAywHJA2MFkghrC/YQPxVRGzQh8SmQMhg7kkYFU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j6QUcz3PhP4L4PLDG47TMfzfiCGosgnrTOUJ3AS3L3K8oNYfuaDXMIK0svwiqAqcEs9fnmo222RTTFyE8C+oPFtO4KsQbiCNGWOmCcwg5jvFRFICArUrVTRmdo3HGabOp/9k=
--=_data-uri--
*/
#pic {
width:670px;height:710px; *background: expression("url(mhtml:" + window.location + "!locoloco)");
}
</style>
<script type = 'text/javascript'>
window.onload = function() { alert(window.location); }
</script>
</head>
<body>
<p>Foo</p>
<div id="pic" ></div>
</body>
</html>
回答1:
You have wrong resources separator in your code:
Content-Type: multipart/related; boundary="=_data-uri"
Here =_data-uri
is a delimiter you have to use to separate images from each other.
E. g.:
/*
Content-Type: multipart/related; boundary="_"
--_
Content-Location:locoloco
Content-Type: image/png
Content-Transfer-Encoding:base64
iV... // image here
--_
Content-Location:locoloco2
Content-Type: image/png
Content-Transfer-Encoding:base64
iV... // image here
*/
You don't need separator at the end of the last image.
In your code you have declared separator =_data-uri
, use separator _
before first image and used =_data-uri--
after it.
To make it work, change first one to the declared one and remove the one in the end.
This code worked for me (also wrote fixed url in mhtml, be sure to change it to the right one for you):
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
/*
Content-Type: multipart/related; boundary="_"
--_
Content-Location:locoloco
Content-Type: image/png
Content-Transfer-Encoding:base64
/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCIFhZWiAH3AABABkAAwApADlhY3NwQVBQTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLWxjbXMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApkZXNjAAAA/AAAAF5jcHJ0AAABXAAAAAt3dHB0AAABaAAAABRia3B0AAABfAAAABRyWFlaAAABkAAAABRnWFlaAAABpAAAABRiWFlaAAABuAAAABRyVFJDAAABzAAAAEBnVFJDAAABzAAAAEBiVFJDAA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Nrmriq5hHYg9zu2Ze6L0QO52kIHmXPqCP3EqljxWzAsefM3eszACnKH6TGyNmv6CBrbMrFncxjLkfS9SpMtMVhDRjD3lVqriOAeZSOVRyAOOIV+jKOZUYZc2vMZGpm/gVbZgHLBA8S8eGODQlvz5lhhAYhN0uXOGUx6Gz/ACXKx9wgtwOmBdfmA6mCMlRcZlBMUoNxR6gYeiO/MwlYAXLwZtfmNoWoYJicqTnpMTRANPP6hsAjHNMfqleTSXO13GxFixDsGHcfbEBnL3MkcoVmyJk1dSqKy2zGRW8wDVCiD6wOh9LDdvULgWaCCnB04j1YW4ZNtiVqHQlWQkGedS1NBVCj6QUcz3PhP4L4PLDG47TMfzfiCGosgnrTOUJ3AS3L3K8oNYfuaDXMIK0svwiqAqcEs9fnmo222RTTFyE8C+oPFtO4KsQbiCNGWOmCcwg5jvFRFICArUrVTRmdo3HGabOp/9k=
*/
#pic {
width:670px;
height:710px;
*background: expression("url(mhtml:http://localhost/~iadramelk/tmp/base64.html!locoloco)");
}
</style>
</head>
<body>
<p>Foo</p>
<div id="pic" ></div>
</body>
</html>
回答2:
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.
"write two different property in a same class"
I am going to explain it below.
<div class="myClass"> </div>
<style>
.myClass {
/*this will work for other browsers*/
background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAHCAYAAADam2dgAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAySURBVHjaYlSdd/4/AwQwQml0PgMTHsn/yIoYCCmEKcKrEFkRTrcxEVIAs46g7wACDACraA+g90OOjwAAAABJRU5ErkJggg%3D%3D');
/* For ie6 and ie7*/
*background:url('give real path_to_image');
}
</style>
来源:https://stackoverflow.com/questions/14889940/base64-image-not-showing-up-in-ie6