The PhoneGap Build “Access Origin” Problem

PhoneGap build makes it easy to create a PhoneGap application without needing to run PhoneGap locally on your own machine.  It does this by combining many of the configuration and plugin settings into a single configuration XML file.  The downside of this is that some of the options are more limited than they would be with standard PhoneGap.

One of these options is “Access Origin”.  This specifies which URLs are allowed to be accessed from within PhoneGap.  Other URLs are either opened in the phone’s standard browser or are denied altogether depending on the call type and access settings.  The problem is that currently iOS and Android builds handle things a little bit differently when it comes to access.    Apparently there is no combination that allows for some URLs to display in the PhoneGap app while others display using an external browser on both iOS and Android.

There are some workaround solutions to this:

  • Have all external links display in the same manner, either in the app or in a browser.  This is not ideal but is a simple solution
  • Create a different config.xml file for iOS and Android builds.  This eliminates the advantage of having a single build for all platforms.
  • Use a plugin such as ChildBrowser to open external links in a browser.  Requires additional configuration.