Adobe AIR应用程序是否可以连接到不公开跨域domain.xml文件的删除Web服务?如果是这样,您如何在Air中配置安全沙箱以允许此操作?
我尝试过套接字并收到以下错误:
securityErrorHandler:
[SecurityErrorEvent
type="securityError"
bubbles=false
cancelable=false
eventPhase=2
text="Error #2048: Security sandbox violation: app:/MyApp.swf cannot
load data from gmail.com:5222." errorID=0
]
答案 0 :(得分:4)
AIR应用程序在浏览器中没有与Flash Player相同的域策略。因此,您通常不需要使用AIR应用程序的跨域策略文件。但是,有时AIR会抛出可以忽略的SecurityErrorEvent。这是一个例子:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:applicationComplete>
<![CDATA[
var s:Socket = new Socket();
s.addEventListener(ProgressEvent.SOCKET_DATA, function(event:ProgressEvent):void {
t.text += event.target.readUTFBytes(event.target.bytesAvailable);
});
s.addEventListener(Event.CONNECT, function(event:Event):void {
t.text += "Event.CONNECT\n\n";
s.writeUTF("GET / HTTP/1.0\n\n");
});
s.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(event:SecurityErrorEvent):void {
trace('security sandbox error ignored');
});
s.connect("www.jamesward.com", 80);
]]>
</mx:applicationComplete>
<mx:TextArea id="t" width="100%" height="100%"/>
</mx:WindowedApplication>