Can I open a link in the system browser? apaprently not. help!

  • 2
  • Problem
  • Updated 7 years ago
  • Solved
Hi everyone, I need to open a link (href) using the system browser and not the app webview.

I'm using PhoneGap 2.9.0 whit this config settings:

<preference name="phonegap-version" value="2.9.0" /&rt;
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="BackupWebStorage" value="cloud" />

<preference name="fullscreen" value="true" />
<preference name="orientation" value="portrait" />

<!-- IOS -->
<preference name="webviewbounce" value="false" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-translucent" />
<preference name="detect-data-types" value="false" />
<preference name="show-splash-screen-spinner" value="false" />
<preference name="auto-hide-splash-screen" value="true" />

<!-- Android -->
<preference name="splash-screen-duration" value="10000" />
<preference name="load-url-timeout" value="30000" />

<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocati...>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notificat...>

<content src="index.html" />

<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
<plugin name="FileTransfer" value="CDVFileTransfer" />
<plugin name="Media" value="CDVSound" />
<plugin name="Capture" value="CDVCapture" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Globalization" value="CDVGlobalization" />
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser" />
<plugin name="InAppBrowser" value="CDVInAppBrowser" />
</plugins>

<access origin="*" />

I'm using Backbone with jQuery mobile

and I've tried these solutions:
- <a href="my-link" onclick="window.open('my-link','_blank','location=yes')" > ...
- <a href="my-link" onclick="window.open('my-link','_system','location=yes')" > ...
- <a href="my-link" target="_blank">
- <a href="my-link" target="_system">

but link always opens on the app webview.

What do I do wrong ?

thanks for help.

regards :)
Photo of Giovanni Miscali

Giovanni Miscali

  • 1 Post
  • 0 Reply Likes

Posted 7 years ago

  • 2
Photo of Mario

Mario, Champion

  • 120 Posts
  • 17 Reply Likes
I use this code and it works for me:

JavaScript
url = encodeURI(url);

window.open(url, '_system', 'location=yes');


config.xml
<preference name="stay-in-webview" value="false" />

<access origin="*" subdomains="true" browserOnly="true" />
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hello Giovanni

Do you still have the above issue? Have you tried above solution by Mario?

Let us know

Thanks
Photo of Geoff

Geoff

  • 6 Posts
  • 0 Reply Likes
I'm running into the same issue where I'd rather use the phone's default browser rather than the appview. I added Mario's code and the javascript causes the site to open, but it still seems to be in the app view as far as I can tell. Are there any other tweaks needed?
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Hi Geoff

Can you share your Build appid? It can be found at the URL bar (http://build.phonegap.com/apps/#####)

Thanks
Photo of Geoff

Geoff

  • 6 Posts
  • 0 Reply Likes
Hi Amir - it is 511713
Not sure if it makes a difference, but months ago I installed Chrome browser on the cellphone I'm testing with and changed my settings to make it the default browser instead of whatever comes out of the box. Perhaps that is causing this configuration to not work?
Photo of Zahir

Zahir

  • 3500 Posts
  • 40 Reply Likes
Hi,

Hope your problem have been resolved.
This issue is now closed.

Create a new issue if you wish to bring up your current topic or have any other problem with PhoneGap Build.

Thanks

This conversation is no longer open for comments or replies.