Search code examples
actionscript-3securityairnavigatetourl

AIR app: navigateToURL throws a SecurityError #2193


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)) throws 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


Solution

  • 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.