![](/img/trans.png)
[英]HTML5 phonegap webapp open links in safari or other native app
[英]Links to open in Safari browser, using Phonegap 3.3
我已經在Phonegap Build 3.3中使用純HTML,CSS和JS構建了一個應用程序。 我想包含一些網站鏈接,這些鏈接我想在Safari中打開,而不是在應用內瀏覽器中打開。 誰能闡明一些想法? 我已經嘗試使用_system作為目標等所有明顯的JS。
Config.xml如下:
<?xml version="1.0" encoding="UTF-8" ?>
<widget
xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
version = "1.1.0">
<preference name="orientation" value="portrait"/>
<preference name="target-device" value="universal"/>
<preference name="fullscreen" value="false"/>
<preference name="disable-cursor" value="true"/>
<preference name="android-installLocation" value="auto"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="webviewbounce" value="false"/>
<gap:config-file platform="ios" parent="UISupportedInterfaceOrientations" overwrite="true">
<array>
<string>UIInterfaceOrientationLandscapeOmg</string>
</array>
</gap:config-file>
<access origin="*" browserOnly="true" />
<preference name="permissions" value="none"/>
<gap:splash src="splash.png" />
<icon src="Icon.png" gap:platform="ios" width="57" height="57" />
<icon src="Icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="Icon@2x.png" gap:platform="ios" width="114" height="114" />
<icon src="Icon-72@2x.png" gap:platform="ios" width="144" height="144" />
<gap:splash src="splash/ios/Default.png" width="320" height="480" />
<gap:splash src="splash/ios/Default_at_2x.png" width="640" height="960" />
<gap:splash src="splash/ios/Default_iphone5.png" width="640" height="1136" />
<gap:splash src="splash/ios/Default-Landscape.png" width="1024" height="768" />
<gap:splash src="splash/ios/Default-Portrait.png" width="768" height="1024" />
</widget>
謝謝你的幫助。
您仍然需要使用InAppBrowser插件,但可以在config.xml中以這種方式配置它:
<gap:plugin name="org.apache.cordova.inappbrowser" />
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
<preference name="stay-in-webview" value="false" />
然后在您的js代碼中:
window.open(url, "_system");
有關InAppBrowser文檔的信息,請參見此處。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.