0

this is my first time using phonegap build and I'm having trouble opening external links inside my app. I'm using jquery mobile and phonegap build to publish an android app. Before the the update to cli-5.2.0 I was able to open external links inside the app using the following code

window.open('http://www.google.com','_self',false);

However after the update to cli-5.2.0 any external link will now only open in Chrome or the in-app browser. Is there any way to open an external link within the app?

Here is my config.xml file just in case

<?xml version='1.0' encoding='utf-8'?>
    <widget id="com.test.chat" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">

<name>Test 3.0</name>

<description>Test App</description>

<author email="dev@cordova.apache.org" href="http://cordova.io">Author
</author>
  <platform name="android">
    <allow-intent href="market:*" />
</platform>
<preference name="phonegap-version" value="cli-5.2.0" />
<content src="index.html" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

<preference name="permissions" value="none"/>
<preference name="orientation" value="portrait"/>
<preference name="target-device" value="universal"/>
<gap:plugin name="org.apache.cordova.splashscreen" source="npm"/>
<!--<gap:plugin name="org.apache.cordova.inappbrowser" source="npm"/>-->

<feature name="http://api.phonegap.com/1.0/geolocation"/>
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="5000" />  
<preference name="fullscreen" value="true" />-->
<gap:splash gap:platform="android" gap:qualifier="port-ldpi"  src="res/drawable-port-ldpi/screen.png" />
<gap:splash gap:platform="android" gap:qualifier="port-mdpi"  src="res/drawable-port-mdpi/screen.png" />
<gap:splash gap:platform="android" gap:qualifier="port-hdpi"  src="res/drawable-port-hdpi/screen.png" />
<gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="res/drawable-port-xhdpi/screen.png" />
<gap:splash gap:platform="android" gap:qualifier="port-xxhdpi" src="res/drawable-port-xxhdpi/screen.png" />
<gap:splash gap:platform="android" gap:qualifier="port-xxxhdpi" src="res/drawable-port-xxxhdpi/screen.png" />
<gap:splash src="splash.png"/>

<icon src="icon.png" />

<icon src="res/drawable-port-ldpi/ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="res/drawable-port-mdpi/mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="res/drawable-port-hdpi/hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="res/drawable-port-xhdpi/xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="res/drawable-port-xxhdpi/xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />
<icon src="res/drawable-port-xxxhdpi/xxxhdpi.png" gap:platform="android" gap:qualifier="fr-xxhdpi" />
</widget> 
speedracer2003
  • 171
  • 1
  • 6
  • 19

1 Answers1

0

You have commented out inappbrowser plugin. Just uncomment below line

<gap:plugin name="org.apache.cordova.inappbrowser" source="npm"/>

or try following in config.xml:

<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />

This should work.

Krunal
  • 317
  • 1
  • 7
  • Make sure you use *CSP* (Content Security Policy) on the webpage that launches your link. Documentation is at the bottom of the *[white-list plugin](https://www.npmjs.com/package/cordova-plugin-whitelist)* –  Oct 11 '15 at 20:28
  • @krunal Thank you for your response. Unfortunately that's not what I'm looking for. I don't want the link to open in the in-app browser or the phone browser (in this case chrome). I want the page to open inside the app itself – speedracer2003 Oct 11 '15 at 22:59
  • Ok. Below links might be helpful. [link1](http://stackoverflow.com/questions/15534630/phonegap-build-how-to-open-external-url-in-device-browser-on-android) and [link2](http://www.midnightryder.com/launching-external-urls-in-phonegap-again-phonegap-2-4-x/) – Krunal Oct 12 '15 at 09:41