Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top