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

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

问题描述

使用RFC 2397数据url方案和IE 6-9版时遇到问题.当使用最新版本的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.

无法显示网页

The webpage cannot be displayed

最可能的原因:

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

您可以尝试的方法:

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

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.

协议类型:

Protocol Type:

说明:未知

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中的frame或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可以嵌套.

出于安全原因,数据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天全站免登陆