Flash 安全沙箱问题:attachment

来源:互联网 发布:宾馆 网络布线收费 编辑:程序博客网 时间:2024/05/16 19:49

错误:

Error #2044: 未处理的 securityError:。 text=Error #2190: 尝试加载 http://10.2.39.23:12007/grs-service/doc/download/20111229-dc13d0b0d3eb4598802f6e156e3c7670.swf 失败,因为它已设置 attachment 的 Content-Disposition。

解决方法见:

http://www.cnblogs.com/coonooo/archive/2011/06/11/fkeditor_flash_cant_play.html

HTTP头中去掉“Content-Disposition ”,Flash就能正常访问,虽后问题解决了,但从小就培养出的刨根问题的优良品格使我在脑袋当中出现了一个大大的问号“?”,“WHY?”,最后通过强大的Google search 我终于得到了答案,以下引用原文:

Starting with version 10,0,2, if Flash Player sees a "Content-Disposition: attachment" header while downloading a SWF file, it will ignore the SWF file rather than play it. Note that this restriction applies only to SWF files and not to other types of content, such as images, sounds, text, or XML files, policy files, etc.

If you control the HTTP server on which the SWF file resides, determine whether you trust the SWF file to execute in the server's domain.If so, remove the "Content-Disposition: attachment" header by changing your HTTP server's configuration.
其大致意思就是:从Flash 10.0.2后,flash会忽略 那些HTTP返回的头中包含了“Content-Disposition: attachment”的SWF文件,其他文件比如FLASH中引用的图片、声音、文本、XMl等其他文件不做此限制。