Reputation: 41
I am generating a base64 gif on the fly and am trying to make a link to a new page to open a full size version of the gif. This works in chrome, but in IE, only the img thumbnail shows. When someone clicks on the link in IE, a blank page opens.
Any thoughts?
Thanks
Matt
echo '<a href="data:image/gif;base64,'. $data. '" target=_blank>';
echo '<img src="data:image/gif;base64,'. $data . '" width="200"/></a>';
Upvotes: 4
Views: 5632
Reputation: 493
If you use Java, you would create a servlet decoder. Like this: https://gist.github.com/sjpuas/6217394 This works me in all IE versiones
With jquery replace url images like this
if ($.browser.msie && $.browser.version == "6.0") {
$("img[src*=base64]").each(function (i, img) {
var base64 = $(img).attr("src").split("base64,")[1];
var encoded = encodeURIComponent(base64);
$(img).attr("src", "/myApp/base64Servlet?base64=" + encoded);
});
}
Upvotes: 1
Reputation: 97727
According to this you cannot use data uri for navigation in IE.
- Internet Explorer through version 7 (approximately 5% of web traffic as of September 2011), lacks support. However this can be overcome by serving browser specific content.[6]
- Internet Explorer 8 limits data URIs to a maximum length of 32 KB. (Internet Explorer 9 does not have this limitation)[4][3]
- In IE 8 and 9 data URIs can only be used for images, but not for navigation or Javascript generated file downloads. [7]
Upvotes: 4