dan*_*dan 4 flash ssl https urlrequest
我有一个fla(使用ActionScript 3.0)我在Flash中编译.我正在使用URLRequest和URLLoader来访问http web服务.
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("http:test.webservice.com");
try {
loader.load(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}
Run Code Online (Sandbox Code Playgroud)
这很好 - 但是如果我尝试访问我得到的https地址
httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0]
ioErrorHandler: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: https://test.webservice.com"]
Run Code Online (Sandbox Code Playgroud)
如何从https Web服务检索数据?SWF是否必须托管在SSL安全页面上?
如果您安装了Flash调试播放器,您可能会在日志中看到以下内容:
** Security Sandbox Violation ***
Connection to https://www.example.com/service/ halted - not permitted from http://www.example.com/your.swf
Error: Request for resource at https://www.example.com/service/ by requestor from http://www.example.com/your.swf is denied due to lack of policy file permissions.
Run Code Online (Sandbox Code Playgroud)
默认情况下,http中托管的swf无法访问https - 它被视为不同的域.
您需要设置相应的crossdomain.xml策略文件,并小心验证Content-Type是text/*还是其他列入白名单的值.此外,您还需要一个带有"secure = false"的元策略文件,该文件允许从http访问https.
<allow-access-from domain="www.example.com" secure="false" />
Run Code Online (Sandbox Code Playgroud)
进一步阅读:
Flash Player 9和Flash Player 10中的策略文件更改
| 归档时间: |
|
| 查看次数: |
9551 次 |
| 最近记录: |