如何使用 base64 编码方法在 IE 中创建链接? [英] How can I make a link in IE using base64 encoding method?

查看:40
本文介绍了如何使用 base64 编码方法在 IE 中创建链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在动态生成一个 base64 gif,并尝试创建一个指向新页面的链接以打开该 gif 的全尺寸版本.这适用于 chrome,但在 IE 中,仅显示 img 缩略图.当有人点击 IE 中的链接时,会打开一个空白页面.

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.

有什么想法吗?

谢谢

马特

echo '<a href="data:image/gif;base64,'. $data. '" target=_blank>';
echo '<img src="data:image/gif;base64,'. $data . '" width="200"/></a>';

推荐答案

根据this 在 IE 中不能使用数据 uri 进行导航.

According to this you cannot use data uri for navigation in IE.

  • Internet Explorer 至第 7 版(截至 2011 年 9 月约占网络流量的 5%)缺乏支持.然而,这可以通过提供浏览器特定内容来克服.[6]
  • Internet Explorer 8 将数据 URI 的最大长度限制为 32 KB.(Internet Explorer 9 没有此限制)[4][3]
  • 在 IE 8 和 9 中,数据 URI 只能用于图像,不能用于导航或 Javascript 生成的文件下载.[7]

这篇关于如何使用 base64 编码方法在 IE 中创建链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆