12-15-2012 01:18 AM
I have an application which downloads data from external server.
The application used to work on Ripple 0.9.16 till it started crashing with "ntdll.dll" error, and I have to switch to new version.
The latest version being only a Chrome extension, doesn't seem to download the data.
In the console, I see error as "Allow-Cross-Origin-Policy".
My Chrome vesion is 23
and is started with "--disable-web-security" --- while at the header it still says that the flag is unsupported.
Any clues on resolving it?
12-15-2012 01:39 AM
Send a CORS header from the external server
I use the following in PHP to return a JSON object
I remove some headers simply to reduce packet size
$jsontxt = <object to return - change this>;
Works on almost everything and defo on BB
12-15-2012 01:51 AM
Quick little test
Try grabbing this
The script here retrieves a tree definition I use to build a JSTree visualisation of a load of files
The data you get back is only of any use within the confines of the system I wrote this for but it uses the CORS header to return a complex object
12-15-2012 04:05 AM
12-15-2012 04:17 AM
Personally I never use Ripple owing to Chrome being so quirky at XDOM
I can tell you for a fact that the CORS header works on everything in the world
If you PM me with your email I'll set you up with a proper web server to test on
Everyone else - this is for rock_win only to help the guy out
I've got a rubbish server and a very good one - I'll stick you on the good one. We got it a few months ago so it's very good
I'll let you have one of my unused domains (got a few left)
You can click the like button now
12-16-2012 05:25 AM
12-16-2012 05:51 AM
The simulator works properly - make sure you get the latest version
I've got a solution in another thread that sorted another developer's problem out
If you read my post in that one you have something that definitely works to test against which may guide you in the right direction
The sample I posted is extremely basic, it's just to show CORS
One idea I have is that if your third party isn't sending CORS headers then use another server as a middle-man
It's a bit of an around about way to do things but rather than go to servera/requesturl go to serverb/requesturl then have that do the fetch and add in the CORS header on serverb then return it to client
The sample I provide can easily be modified to do just that
When you get a stable version PM me and I'll grab a copy of the bar file and test it on a Dev Alpha if you like so you can be 100% it'll work on a physical device
One thing to note is that in the simulator you may be able to skip CORS all together as most mobile browsers (apart from Droid) use webkit and don't enfore CORS like Chrome does
This means that it's very likely that your app will work as-is in the Sim / on a device
CORS is required if your target browser is Chrome based
I leave the direction you take up to you
Personally I always CORS everything to make ports easy