我有一个应用程序,可以将文件上载/下载到/从box.net。如果应用程序不是部署在服务器上,而是部署在Google上,则会遇到以下错误。
错误#2044:未处理的securityError:。text=Error #2048:安全沙箱违规:http://somexyz.appspot.com/xyzsample.swf无法从http://box.net/api/1.0/download/abcdef/123456加载数据。
我已经在as3中包含了下面的代码行
Security.allowDomain("*");
并将crossdomain.xml放在应用程序根文件夹(Google )中,并可以使用crossdomain.xml访问该文件。
crossdomain.xml包含以下行
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
<allow-http-request-headers-from domain="*"/>
</cross-domain-policy>
当我尝试使用tomcat时,我也遇到了同样的问题。
发布于 2012-08-15 23:18:40
如果从box.net加载,则需要检查http://box.net/crossdomain.xml
在这里你可以读到以下内容:
<!--
Box has recently changed its crossdomain policy for API calls made from Flash.
To continue using Box API, please add the following line to the code of your Flash
application:
- AS2: System.security.loadPolicyFile("http://www.box.net/api/crossdomain.xml");
- AS3: Security.loadPolicyFile("http://www.box.net/api/crossdomain.xml");
-->
更新
请确定您正在按顺序添加以下内容:
Security.loadPolicyFile("http://www.box.net/api/crossdomain.xml")
装货时:
*.load('http://www.box.net/api/1.0/download/abcdef/123456');
因此,服务器的路径将是相同的:http://www.box.net/
对于flash,http://www.box.net/和http://box.net/是两个不同的域名。
https://stackoverflow.com/questions/11981702
复制相似问题