Blog

What keeps us busy?
Our stories from the Trenches.

Posts with tag tag Android

Cordova: Open External Links in the Native Browser

Written by Sepp Wijnands on Friday 15 November 2013 in mobile

If you want to open an external website or a user's Facebook page, you more than likely would like to open it in their mobile's platform main browser.

But, by default in Cordova/Phonegap, when a (external) link is clicked, it will just load it into your application view instead. Thereby potentially messing up the state of your application, and leaving you with no control over when or if the user decides to return to your application.

iOS users of your application will have it even worse. Since iOS has no built-in concept of a 'back' button, this pretty much guarantees that a user cannot return to your application, without terminating it first.

Not a pretty sight. Luckily, there's an easy fix.

Cordova: Whitelist rejection error

Written by Sepp Wijnands on Tuesday 12 November 2013 in mobile

In older versions of Phonegap and Cordova the default setting was to disallow applications to access any external network host, unless explicitly specified in the config file.

If you are unfamiliar with this functionality, the first time you try to access an external resource, you will be greeted by the following error message in some form or another:

2013-11-12 18:06:04.847 HelloCordova[14941:70b] ERROR whitelist rejection: url='http://www.facebook.com/'

Upgrading to a newer version of Cordova/Phonegap will not automatically fix this problem for you, because the policy is controlled by the www/config.xml file, which will be generated only once, and then be left alone by the command line utilities.

Since 2006 our products and services have helped hundreds of people optimize their daily business: