数据 URI 方案和 Internet Explorer 9 错误 [英] Data URI scheme and Internet Explorer 9 Errors

查看:23
本文介绍了数据 URI 方案和 Internet Explorer 9 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IE 版本 6-9 中使用 RFC 2397 数据 url 方案时遇到问题.使用当前版本的 Safari、FF、Opera 和 Chrome 时,我下面的示例代码可以正常工作.

I'm having a problem using the RFC 2397 data url scheme with IE versions 6-9. My sample code below works without problem when using current versions of Safari, FF, Opera and Chrome.

data:text/html;base64,PG1ldGEgaHR0cC1lcXVpdj0icmVmcmVzaCIgY29udGVudD0iMDt1cmw9aHR0cDovL2dvb2dsZS5jb20vIj4g

data:text/html,%3Cmeta%20http-equiv%3D%22refresh%22%20content%3D%220%3Burl%3Dhttp%3A//google.com/%22%3E%20

如果将上述代码粘贴到除 IE 之外的几乎所有浏览器中,它将导航到 google.com,当尝试使用 IE 时,它会失败并显示以下错误.

If the above code is pasted in almost any browser excluding IE it will navigate to google.com, when attempting with IE it fails with the following error.

网页无法显示

最可能的原因:

  • 此网页上的某些内容或文件需要您尚未安装的程序.

你可以尝试什么:

在线搜索可用于查看此网络内容的程序.

Search online for a program you can use to view this web content.

重新输入地址.

在检查生成的 IE 错误页面的页面源时,有一个引用文件关联和协议的链接.

When inspecting the page source of the IE error page generated there is a link that makes reference to File Associations and protocols.

协议类型:

说明:未知

Windows 无法识别此协议.

Windows does not recognize this Protocol.

我意识到使用 data: 协议可能不是最直接的,或者在大多数情况下不是最好的选择,但我必须将它用于这个特定的项目.

I realize that using the data: protocol is probably not the most straight forward or in most cases the best option, but I must use it for this particular project.

我四处寻找解决方案,并在 IE 中尝试了许多示例,希望这是我的语法,但尚未找到解决方案.

I have searched all over for a solution and tried many examples with IE hoping it was my syntax but have yet found a solution.

推荐答案

数据 URI 不能用于导航、脚本编写或填充 IE 中的框架或 iframe 元素.

Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements in IE.

根据 http://msdn.microsoft.com/en-us/library/cc848897%28v=vs.85%29.aspx:

数据 URI 仅支持以下元素和/或属性.

Data URIs are supported only for the following elements and/or attributes.

object (images only)
img
input type=image
link
CSS declarations that accept a URL, such as background, backgroundImage, and so on.

数据 URI 可以嵌套.

Data URIs can be nested.

出于安全原因,数据 URI 仅限于下载资源.数据 URI 不能用于导航、脚本或填充框架或 iframe 元素.

For security reasons, data URIs are restricted to downloaded resources. Data URIs cannot be used for navigation, for scripting, or to populate frame or iframe elements.

数据 URI 不能超过 32,768 个字符.

Data URIs cannot be larger than 32,768 characters.

资源数据必须正确编码;否则会出错并且资源未加载.#"和%"字符必须是编码,以及控制字符、非美国 ASCII 字符和多字节字符.

The resource data must be properly encoded; otherwise, an error occurs and the resource is not loaded. The "#" and "%" characters must be encoded, as well as control characters, non-US ASCII characters, and multibyte characters.

有关更多信息,请参阅 RFC2397:数据"URL 方案.

For more information, see RFC2397: The "data" URL scheme.

适用于 Windows Internet Explorer 8 或更高版本.**

Available as of Windows Internet Explorer 8 or later.**

这篇关于数据 URI 方案和 Internet Explorer 9 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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