javascript – Cordova / Phonegap 3.3中的外部链接/ InAppBrowser总是表现得像“_self”

我试图在Phonegap应用程序中打开链接,该应用程序在“可关闭的”InAppBrowser中打开,或者至少在外部Safari出现时打开,而不是在Webview本身内部.

使用_blank或_system总是会产生’_self’beahviour(页面在Webview中打开).

我正在尝试一个全新的Phonegap项目,针对iOs.模拟器和设备上的问题相同.

InAppBrowser已正确安装:

$cordova plugins ls
[ 'org.apache.cordova.inappbrowser' ]

project.xml没什么好看的:

<?xml version='1.0' encoding='utf-8'?>
<widget id="me.nerik.superpo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>Test</name>
    <description>
        Hello World sample application that responds to the deviceready event.
    </description>
    <author email="support@phonegap.com" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <feature name="http://api.phonegap.com/1.0/device" />
    <preference name="permissions" value="none" />
    <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="stay-in-webview" value="false" />
    <preference name="ios-statusbarstyle" value="black-opaque" />
    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="true" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="disable-cursor" value="false" />

    <icon src="icon.png" />
    <icon gap:platform="ios" height="57" src="res/icon/ios/icon-57.png" width="57" />
    <icon gap:platform="ios" height="72" src="res/icon/ios/icon-72.png" width="72" />
    <icon gap:platform="ios" height="114" src="res/icon/ios/icon-57-2x.png" width="114" />
    <icon gap:platform="ios" height="144" src="res/icon/ios/icon-72-2x.png" width="144" />
    <gap:splash gap:platform="ios" height="480" src="res/screen/ios/screen-iphone-portrait.png" width="320" />
    <gap:splash gap:platform="ios" height="960" src="res/screen/ios/screen-iphone-portrait-2x.png" width="640" />
    <gap:splash gap:platform="ios" height="1024" src="res/screen/ios/screen-ipad-portrait.png" width="768" />
    <gap:splash gap:platform="ios" height="768" src="res/screen/ios/screen-ipad-landscape.png" width="1024" />

    <access origin="*" />

    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>

</widget>

这是javascript:

var app = {
// Application Constructor
initialize: function() {
     document.querySelector("h1").onclick = function()
    {
        console.log("clicked !");
        // var ref = window.open( "http://google.com", '_blank', 'location=yes');
        var ref = window.open( "http://nerik.me", '_system');
    };

}
};

解决方法:

碰巧我没有等待’deviceready’开火.
在某些时候,我(愚蠢地)评论了等待应用程序启动事件的部分,因为’deviceready’不再被激活.
我不得不用cordova.js替换phonegap.js.我不知道为什么:(

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...