phonegap -window. -location在iOS中不起作用



我正在尝试将我的Web应用程序加载到PhoneGap中,但是我似乎无法将其重定向到iOS中。但是,它确实在浏览器中正确重定向。我的JS,只是为了保持简单,看起来像这样:

onDeviceReady: function() {
    console.log('Received Device Ready Event');
    window.location.href = "http://example.com";
},

我的config.xml包含以下内容:

<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="*://example.com/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>

有什么想法为什么它可以在浏览器中起作用,而在iOS中不起作用?我确定我缺少一些简单的东西...

我弄清楚了。我在iOS上使用了PhoneGap开发人员应用程序,事实证明,CSP被该应用程序覆盖。如果您想测试外部链接,显然您需要编译应用程序并将其安装在设备上,而不是使用PhoneGap开发人员应用程序。请参阅此处:https://github.com/phonegap/connect-phonegap/issues/163

最新更新