这是我第一次使用phonegap版本,而且我在应用内打开外部链接时遇到问题。我使用jquery mobile和phonegap build来发布一个Android应用程序。在更新cli-5.2.0之前,我可以使用以下代码在应用程序内打开外部链接
window.open(' http://www.google.com'' _self',FALSE);
然而,在更新到cli-5.2.0后,任何外部链接现在只能在Chrome或应用内浏览器中打开。有没有办法在应用程序中打开外部链接?
以下是我的config.xml文件以防万一
<?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>
答案 0 :(得分:0)
您已注释掉了inappbrowser插件。只需在线下取消注释
<gap:plugin name="org.apache.cordova.inappbrowser" source="npm"/>
或在config.xml中尝试以下内容:
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />
这应该有用。