PDA

View Full Version : AIR : Ext.Ajax.request not working



ghyster
25 Feb 2008, 7:51 AM
I'm trying to build an AIR app to access remote data but Ext.ajax.request fails :

"Error: Adobe AIR runtime security violation for JavaScript code in the application security sandbox (eval)"

I looked into the ExtDocs AIR app and saw that there was a call to http://extjs.com/playpen/api.php when searching in the API (using an HttpProxy)

How does it work ?

jay@moduscreate.com
25 Feb 2008, 8:05 AM
you'll have to use scriptag proxy to do cross-domain requests.

ghyster
25 Feb 2008, 8:14 AM
cross-domain requests are allowed in AIR apps (eg the ExtDocs app)

the eval function is not allowed and I wondered how Jack make ajax requests work in the ExtDocs app

jay@moduscreate.com
25 Feb 2008, 8:42 AM
crap, you're right. :) I have little experience with air. 8-|

Phunky
26 Feb 2008, 7:46 AM
Does the new version of Ext get around this?!

bricemason
26 Feb 2008, 8:11 AM
You might be interested in this blog series I did which outlines how to use Ext in an AIR app. It all comes down to Adobe's security model. Here's the link, it's a five part series but the first part may be all you need as it contains links at the bottom to Adobe docs:

http://dev.aol.com/blog/bricemason/adobe-air-xdrive-picture-syncing-part-1

ghyster
3 Mar 2008, 12:30 AM
thanks bricemason for your article,

however I found that the ajax request worked well, the problem was I used Ext.decode to decode the response, the security issue was there

RobSmith
6 Mar 2008, 5:26 AM
How did you work around the decode issue? I also want get the response as JSON and actually need to decode it.

sven
6 Mar 2008, 5:36 AM
Eval with a JSON string is allowed in air 1.0.

if you need more "eval" set up the browser sandbox by using an iframe

RobSmith
6 Mar 2008, 5:47 AM
Thanks for reply, I only need JSON evaluation.

sven
6 Mar 2008, 6:01 AM
Well, that should work... since beta 3 ;)