Accessing external resources
Allowing access to external resources
By default, BlackBerry WebWorks apps cannot access data from external resources. For example, a BlackBerry WebWorks app cannot retrieve an HTML web page, unless you configure the app to allow access.
To allow access to external resources, you must specify permissions in config.xml. You can define the list of domains that your app is allowed to access using app permissions.
- Use the same precautions that you would use for a hosted web site, to protect against users with malicious intent.
- Protect your communication channel by using HTTPS when you expose sensitive APIs to the domain.
In the following example, we use the access element to specify that the site is accessed only over HTTPS to the specified APIs:
<access uri="https://somedomain.com" subdomains="true" />
Allowing requests to any web site
If your app is designed to access data from an unknown domain or a changing domain, you can use the access element element with the wildcard character (*) to make sure that your requests are not blocked. For example:
<access uri ="*"/>
The wildcard character (*) cannot be used for data accessed by XMLHttpRequest. To access data using the XMLHttpRequest, you must explicitly specify each domain.
When you use the wildcard character (*), web pages that your app accesses cannot access any of the app APIs.
In the example above, all requests that do not access content via XHR and that do not require access to app APIs are allowed:
Last modified: 2013-11-27