phonegap 3.2 blackberry10 cross origin access is not allowed

1.1k views Asked by At

I have cordova/phonegap app that is running fine now on iOS, Android and even wp8. I build the app for blackberry10 and was able to run it in simulator. First thing the app does is try to make some remote XHR calls, but these fails. Here are the errors I am seeing in the remote chrome console:

403 (Forbidden)

https://bloblbolob.kjsdghs.dsf Origin local:// is not allowed by Access-Control-Allow-Origin.

XMLHttpRequest cannot load https://sdkjf.jksdj.kdj Origin local:// is not allowed by Access-Control-Allow-Origin.

I have edited the config.xml and manually replaced the access property with this line:

<access subdomains="true" uri="*" />

However, that did not make any difference.

3

There are 3 answers

2
Adam Stanley On BEST ANSWER

The * wildcard is not allowed with XmlHttpRequest (XHR) on BlackBerry 10.

If you intend to use XHR in your BlackBerry 10 app, you must white list the URL as an access element in config.xml.

More information about accessing external resources: https://developer.blackberry.com/html5/documentation/beta/accessing_external_resources_webworks.html

6
Christian Kuetbach On

There is one possibiblity to bypass your problem. You can completely disable the WebSecurity for your app:

http://cordova.apache.org/docs/en/3.2.0/guide_platforms_blackberry10_config.md.html

<preference name="WebSecurity" value="disable"/>

This has some negative impact, but will solve your problems. I had the same problem, because the backend of my app is hosted in our customers network. This makes it impossible to whitelist the server.

0
Aadil Keshwani On

In your config.xml add

<access subdomains="true" uri="http://domain.in" /> as this is separate tag for blackberry

PLEASE NOTE : DO NOT ADD * in URI section as Blackberry does not allow “*” wildcard characters there.