我一直在使用的科尔多瓦 - 插件,插件inappbrowser了很长的时间,现在,当我的软件更新到10.2.1我的苹果测试设备的插件没有多头正常工作。当我尝试打开inappbrowser链接没有任何事情发生,除非我点击主页按钮,返回到应用程序。出现这种情况的模拟,以及像iPad真设备,iPhone 5S,iPhone 6和iPhone 7.它工作正常,在Android设备上只是没有最新的iOS。
这里的一切,我尝试过的列表:
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' gap: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; child-src 'self' 'unsafe-inline' *;">
我似乎无法找到别的尝试,因为大多数的帖子我也发现有类似的问题没有得到回答。
下面是相关代码到inappbrowser插件的安装方式和正在使用:
config.xml的结构
<widget>
<content src="index.html"/>
<access origin="*"/>
<allow-navigation href="*"/>
<preference/>
...
<feature name="StatusBar">
...
</feature>
<platform name="ios">
... icons and splash ...
</platform>
<plugin name="cordova-plugin-inappbrowser" spec="~1.7.1"/>
</widget>
在控制器使用插件
$scope.showLink = function(url){
var options = {
location: 'yes'
}
$cordovaInAppBrowser.open(url, '_blank', options)
.then(function(event){
// success
console.log('inappbrowser', event);
})
.catch (function(event) {
// error
console.log('inappbrowser error', event);
});
};
$scope.openUrl = function(url) {
window.open(url, '_blank', 'location=no');
};
我使用的离子v1.7.14,科尔多瓦:6.2.0和Xcode中8
正如CodeGems建议,在评论中,加入gap://ready
您Content-Security-Policy
应该解决的问题。