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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM