问题描述
- flex web项目 安全沙箱冲突问题
-
本人想通过flex页面调用客户端本地的一个socket实现智能提醒功能(该程序是客户端程序,非web项目),根据网上的资料,本人是在本地先测试的,然而还是报
“encounter security error:Error #2048: 安全沙箱冲突:http://localhost:8080/CommunityHealth/SocketTest.swf 不能从 127.0.0.1:5025 加载数据。”,已经尝试了好几天了一直实现不了,还请前辈们指导:
具体情况如下:
自己的tomcat下的root目录中放置了crossdomain.xml内容如下(本人通过浏览器浏览该xml没有问题):
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">然后在页面初始化的时候加载策略文件,代码如下
private var sock:XMLSocket = null;
//Initial the GUI
private function initApp():void {
Security.loadPolicyFile("http://localhost:8080/crossdomain.xml");
}
//Click logon
private function connectServer(event:MouseEvent):void {
if (this.sock != null)
return;
this.sock = new XMLSocket();
//Refer to XMLSocket document, follow the sample here
this.configureListeners(this.sock);
this.sock.connect("127.0.0.1", 5025);
this.sendButton.enabled = true;
}
解决方案
关于Flex安全沙箱的问题
关于Flex安全沙箱的问题
Chrome浏览器下调试flex项目时出现安全沙箱冲突的问题
时间: 2024-08-03 20:43:44