Tuesday, February 26, 2008

Do ScriptTagProxy with AIR


With AIR Beta 3 you cannot do XHR to remote domain, so you have to create new html file as root file then you call your real index file using <iframe> tag.

Set allowcrossdomainXMLHttpRequest and allowcrossDomainxhr parameter to true , then set your remote domain to sandboxRoot parameter, and dont forget to add src parameter and point to your index file.

If AIR application looks bad, just modified using style code bellow:

<style>
body {margin:0px; padding:3px}
iframe {border:0px; width:603px; height:270px;}
</style>
<iframe id="UI"
src="wsclient.html"
allowcrossdomainXMLHttpRequest="true"
allowcrossDomainxhr="true"
sandboxRoot="http://http://example.com/test_folder/"
documentRoot="app:/"
</iframe>
Hope its help...lets go XHR
Agus Sudarmanto.

No comments: