Skip to content
Prev Previous commit
Next Next commit
Wrap inappbrowser check in try catch
otherwise it will throw an exception
  • Loading branch information
jperl committed Jun 11, 2014
commit 3621b22d919944fecdab7227197eb214c216aa55
9 changes: 6 additions & 3 deletions patch_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ window.patchWindow = function () {
if (window.IAB) return;

// Make sure the InAppBrowser is loaded before patching the window.
var inAppBrowserLoaded = !!(window.cordova && window.cordova.require('org.apache.cordova.inappbrowser.inappbrowser'));
if (!inAppBrowserLoaded) return false;

try {
window.cordova.require('org.apache.cordova.inappbrowser.inappbrowser');
} catch (e) {
return false;
}

// Keep a reference to the in app browser's window.open.
var __open = window.open,
oauthWin,
Expand Down