Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
rock_win
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

unable to test Cross-Origin in Ripple 0.9.10

Hi,

 

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?

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: unable to test Cross-Origin in Ripple 0.9.10

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

 

<?php

$jsontxt = <object to return - change this>;

 

header("Content-Type: text/javascript");
header('Access-Control-Allow-Origin: *');
header_remove("X-Powered-By");
header_remove("Set-Cookie");
echo $jsontxt;
?>

Works on almost everything and defo on BB

 




Click the like button if you find my posts useful!
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: unable to test Cross-Origin in Ripple 0.9.10

Quick little test

 

Try grabbing this

 

beta.5app.co.uk/apptree/lib/treenode.php?appid=154&domain=beta.5app.co.uk

 

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

 

 




Click the like button if you find my posts useful!
Please use plain text.
Developer
rock_win
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: unable to test Cross-Origin in Ripple 0.9.10

I have read about this solution, but unfortunately, I dont have access to the server.

Is this now a mandate with the new ripple-chrome Extension.

Because the previous standalone one used for work just fine.
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: unable to test Cross-Origin in Ripple 0.9.10

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 :smileyhappy:

 

 




Click the like button if you find my posts useful!
Please use plain text.
Developer
rock_win
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: unable to test Cross-Origin in Ripple 0.9.10

@peardox - appreciate the gesture of extending the server.

but unfortunately this data is coming from third party, thus not sure how setting up the server would go.

If you can elaborate more on that, then probably i can do the same with my own server self.

another interesting thought where you mentioned that about not using ripple.

Can you share then how one can go about testing the Webworks application,specially when the 'blackberry.<api>' would fail otherwise.

Would be happy if you to receive your PM on the same, if you dont want to disclose it with the community.
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: unable to test Cross-Origin in Ripple 0.9.10

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

 

Oh, yeah...

 

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

 




Click the like button if you find my posts useful!
Please use plain text.