Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

navigator.app undefined

Tags:

xcode

ios

cordova

I'm trying to use:

navigator.app.loadUrl("http://www.google.com", { openExternal:true } );

And it does not work for iOS, either on device and simulator. I've used this same line of code in a similar project, and I'm using the same version of phonegap on both (1.5.0). On android the same code works perfectly. The device ready function also fires, so I'm guessing phonegap is being loaded. I'm not using the phonegap.js file of android, I've checked that.

While debugging I found that navigator.app is an undefined object. Does anybody have any idea of a configuration I might be missing to cause this?

Thanks for your help.

Cheers, Miguel

like image 682
mhcarneiro Avatar asked Dec 10 '12 14:12

mhcarneiro


1 Answers

The "navigator.app" object is only available on Android. Luckily in the soon to be released 2.3.0 version of PhoneGap you will be able to do:

window.open("http://www.google.com", "_system");

to do exactly what you want to do.

like image 130
Simon MacDonald Avatar answered Sep 28 '22 04:09

Simon MacDonald