I'm trying to port an existing web app (ActionScript 3 only project) to AIR, to run as a standalone application. One of its features is opening urls in a browser window. But calling navigateToURL(new URLRequest(url))
throw开发者_开发百科s this SecurityError:
SecurityError: Error #2193: Security sandbox violation: navigateToURL: app:/AIRDigE.swf cannot access http://www.youtube.com/watch?v=xCPwAr0xnGE. at global/flash.net::navigateToURL()
when run from Flash Builder 4.
Googling doesn't really help me with this specific error number.
Adobe's reference on Security Sandboxes states that any AIR application running with Security.sandboxType==Security.APPLICATION
(which my application uses) should be able to connect to any domain, but apparently that doesn't count for me.
Any ideas?
Thanks, Frank
Sorry folks, this morning I found the answer myself: the url that I passed into the URLRequest had a space in front of it (it was loaded from an xml feed that is evidently producing faulty urls).
So it seems that a url with an invalid protocol causes that error, and putting a trim()
around the url fixed it.
I was getting this error because of using double backward slashes in the web link like "http:\\www.youtube.com"
Where as I supposed to use "http:*//*www.youtube.com"
try using URLRequest with navigateToURL
navigateToURL(new URLRequest("http://www.youtube.com"));
UPDATED:
navigateToURL(new URLRequest("http://www.youtube.com"),"blank");
精彩评论