在Phonegap应用程序中的App中打开的外部URL

时间:2014-06-03 10:50:47

标签: javascript cordova cordova-plugins

我突然遇到一个问题,我之前正在使用的代码(Facebook分享)。 应该在浏览器中打开的URL现在从应用程序本身打开。

JS:

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

config.xml中

<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns     = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.phonegap.test"
        version   = "1.1">

    <name>test</name>    
    <description>
        test
    </description>    
    <author href="http://www.test.de" email="tesdt@test.de">
        test
    </author>    
    <feature name="http://api.phonegap.com/1.0/device" />
    <feature name="http://api.phonegap.com/1.0/geolocation"/> 

    <preference name="phonegap-version"           value="3.3.0" />  
    <preference name="splash-screen-duration"     value="25000" />
    <preference name="orientation"                value="default" />  
    <preference name="target-device"              value="universal" /> 
    <preference name="fullscreen"                 value="true" />   
    <preference name="webviewbounce"              value="true" />  
    <preference name="prerendered-icon"           value="true" /> 
    <preference name="android-installLocation"    value="auto" />         
    <preference name="stay-in-webview"            value="false" />

    <gap:plugin name="org.apache.cordova.geolocation" />
    <gap:plugin name="org.apache.cordova.network-information" />
    <gap:plugin name="org.apache.cordova.inappbrowser" />   

    <access origin="*" browserOnly="true" /> <!-- allow local pages -->    
</widget>

我尝试了各种选项,如:

试用1:

navigator.app.loadUrl(url, { openExternal:true } );

试用2:

var myURL   ="http://www.google.com/";
myURL       = encodeURI(myURL);
window.open(myURL, "_system", 'location=yes');

试用3:

window.open(url,"_blank","location=yes");

要通过window.open()打开的示例网址:

&#34; https://www.facebook.com/dialog/feed?app_id=493705490741836&display=popup&caption=Gretl&link=https://test.com/web/&picture=https://test.com/web/img/logo_top.png&name=Gretl&description=Name : LEHNER-HOF Stand Bauernmarkt Altmühlstraße%0D%0A%0D%0AAdresse%0D%0A%0D%0AAltmühlstraße - Nähe Landratsamt, 93059, %0D%0ARegensburg%0D%0A%0D%0ATelefonnummer:09464 647%0D%0A%0D%0AÖffnungszeiten%0D%0A%0D%0AMo : kein Marktbetrieb%0D%0ADi : kein Marktbetrieb%0D%0AMi : kein Marktbetrieb%0D%0ADo : 13:30 bis 17:30%0D%0AFr : kein Marktbetrieb%0D%0ASa : kein Marktbetrieb%0D%0ASo : kein Marktbetrieb%0D%0A%0D%0A%0D%0AApp Store URL : https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=62ss6187738&mt=8%0D%0A%0D%0AURL : https://test.com/%0D%0A%0D%0APlay Store URL : https://www.test.com&redirect_uri=https://test.com/&#34;

但似乎没有任何效果。任何帮助是极大的赞赏。

0 个答案:

没有答案