Cordova 3.3 InAppBrowser _blank vs _self Problems

There are a number of oddities about working with InAppBrowser in Cordova 3.3 viewport scaling which may pose varying levels of annoyance across iOS and Android. In particular, there are several important differences between using _self and _blank.

Beware _self vs. _blank Differences

Opening a browser window using the target “_self’ looks like this:

this.windowRef = window.open('http://www.google.com', '_self');

This will load an external site in the current browser window. The viewport scaling and configuration settings for a browser window opened this way will come from you config.xml and from the index.html.

If you ever decide to use the “_blank” target (which opens a browser in a modal dialog) like this:

this.windowRef = window.open('http://www.yoursite.com', '_blank', 'location=yes,toolbar=yes,EnableViewportScale=yes,DisallowOverscroll=yes');

None of the browser scaling settings in your Config.xml or index.html are going to apply. As in the example above, you will have to force feed them through into the plugin as I am doing in the example.

How To Write A Cross-Platform Cordova 3.3 App for Android and iOS

CordovaWriting an app in Cordova 3.3 for iOS 7 and Android? This is the article for you.

This article will cover the specifics of…

  • Setting up a Cordova 3.3 development environment for iPhone, iPad and Android application creation
  • Configuring your Bash profile accordingly to interact with Cordova in a happy manner
  • Setting up and installing Cordova plugins which may be useful such as Splash Screen and In App Browser
  • Using Cordova’s CLI tools to install and manage Cordova plugins
  • How to package and distribute your Android and iOS application on TestFlight

If you are the book-reading sort, you can also check out: Apache Cordova 3 Programming (Mobile Programming).

You can also read more here: http://iphonedevlog.wordpress.com/2013/12/19/using-phonegap-3-3-cli-on-mac-os-x-mavericks-to-build-ios-projects/.

[Read more…]

Proper Cordova Plugman Install Syntax

The documentation for Cordova’s Plugman tool does not match how it actually works.

The documentation will tell you to run:

plugman --platform ios --project . --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

If you try to install that way, you will just get the plugman documentation.

In actuality, the correct syntax is:

plugman install --platform ios --project . --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

Where “.” is the local directory if you are running the command from terminal inside your project dir.