Cordova – PhoneGap: external url

The inclusion of the InAppBrowser in iOS and Android will be new for Cordova 2.3.0. The InAppBrowser is a built-in web browser for your app that has an API that follows web standards.

Domain whitelisting in Apache Cordova is a security model that controls access to outside domains, such as http://google.com. The default security policy is to block all network access. The application developer can then declare access to specific network domains and subdomains. The domain whitelisting rules are found in config.xml located in your application root directory.

  • _self – opens in the Cordova WebView if url is in the white-list, else it opens in the InAppBrowser
  • _blank – always open in the InAppBrowser
  • _system – always open in the system web browser

Quick Example:

  // The scope of 'this' is the event.
  onDeviceReady: function() {
    var ref = window.open('http://www.domein.com', '_self', 'location=no');
  }

Leave a Reply