Thomas Juranek Thomas Juranek - 1 month ago 18
AngularJS Question

Cordova InAppBrowser Crashes Application

$scope.openMaps = function () {
if (aboutData.Address) {
$scope.location = cordova.InAppBrowser.open('http://maps.google.com/?q=' + aboutData.Address + ' ' + aboutData.City + ', ' + aboutData.State, '_system', 'location = yes');
}
else {
$scope.location;
var alertPopup = $ionicPopup.alert({
title: 'Error:',
template: 'A location was not found!'
});
}
}


The above function is called on a button click. It opens the url in the Google Maps app if the app is on the device (I'm on Android) otherwise it opens it in the devices web browser (using the cordova in app browser plugin).

I am getting an error on Android where it opens the maps app with the correct location, and then when I try to return to the app it has crashed. This is the error:

net::ERR_FILE_NOT_FOUND(file:///android_asset/www/*longfilepath*)


Any help would be appreciated!

Answer

FIX: Use window.open instead of cordova.InAppBrowser.open.