7

I'm using Phonegap 2.3 and I'm considering updating to the newer library. I think this might be a problem that was fixed with the newer library.

Anyway I have tried:

window.open('http://google.com','_blank')

window.location = "http://google.com";

Both had no luck forcing the user to load the external link in safari.

I also ready about targeting _system which didn't work either.

JAppleseed
  • 73
  • 1
  • 4

2 Answers2

3

There is a config.xml setting that will do the trick:

<preference name="stay-in-webview" value="true" />

Or, you can use _system if you include the InAppBrowser plugin.

<a href="#" onclick="window.open('http://www.nhl.com', '_system', 'location=yes');">_system</a>

InAppBrowser API Doc

Here's a couple related threads:

https://build.phonegap.com/docs/config-xml (page search for "stay-in-webview")

PhoneGap Build: how to open external url in device browser on Android?

Community
  • 1
  • 1
ezekielDFM
  • 1,947
  • 13
  • 26
  • Thanks I just need to find the config.xml – JAppleseed Jun 04 '13 at 15:55
  • No problem. This should point you in the right direction. Now, how about an upvote and marking the answer as correct? ;) http://docs.phonegap.com/en/2.4.0/guide_project-settings_index.md.html – ezekielDFM Jun 04 '13 at 17:41
  • Where does it say that the `_system` has been deprecated? – cherouvim Jan 29 '14 at 08:42
  • Looks like it isn't. The "ChildBrowser" plugin is now deprecated and the functionality has now been moved to the InAppBrowser API. I will edit my answer accordingly. http://community.phonegap.com/nitobi/topics/_childbrowser_plugin_deprecating_use_inappbrowser – ezekielDFM Feb 04 '14 at 12:44
1

For Phonegap 3 you have to install the InAppBrowser plugin and then do:

window.open("http://google.com", "_system");
jackocnr
  • 17,068
  • 10
  • 54
  • 63