【腾讯云】云产品限时秒杀,爆款1核2G云服务器,首年99元

ionic ios iframe 白屏

之前碰到一个问题:

在ios下边使用iframe出现白屏问题

android下边正常

原因是ios对app打开外部网页有限制需要取消限制

解决方法

1.确认添加whitelist 插件

2.在config.xml中添加

<plugin name="cordova-plugin-whitelist"      source="npm" spec="1.1.0" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />

3.在index.html中添加如下代码

<meta http-equiv="Content-Security-Policy" 
         content="default-src *; 
                  style-src * 'self' 'unsafe-inline' 'unsafe-eval'; 
                  script-src * 'self' 'unsafe-inline' 'unsafe-eval';">

 

参考地址

http://stackoverflow.com/questions/36318185/how-can-i-allow-a-cordova-6-1-app-to-embed-an-iframe-in-ios-from-a-website?answertab=active#tab-top

posted @ 2016-12-06 18:38  happenzh  阅读(2934)  评论(0编辑  收藏  举报