在我最近建立之前,我的cordova应用程序能够很好地嵌入网站的iframe;现在,大概是在我忘记了更新后,构建应用程序导致iframe在iOS上空白但在Android中有效。
我已将以下设置添加到config.xml:
<access origin="*"/>
<access origin="*.pushwoosh.com" />
<access origin="*.hoby.org" />
<allow-navigation href="*" />
<allow-intent href="*" />
以及以下内容安全政策:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
基本上应该允许一切。我使用cordova 6.1.0和Ionic 1.7.14
添加了cordova-whitelist插件编辑:它实际上适用于iOS模拟器,但在我在设备上运行时则无效。
编辑2:好像它可能是一个移动游猎问题;我正在通过我的网络查看文件,甚至在科尔多瓦之外他们没有正确加载。我可以证实,这至少在几天之前就有效了。
答案 0 :(得分:22)
@Phil,
您的 for( int x = 0; x < rp.studentRecords.length; x++){
System.out.println("Student name: " +rp.studentRecords[x].getName());
System.out.println("Major: "+ rp.studentRecords[x].getClass().getName());
System.out.println("Age: "+ rp.studentRecords[x].getName());
System.out.println("Year " +rp.studentRecords[x].getYear());
System.out.println("Credits Earned: "+ rp.studentRecords[x].getCredits());
System.out.println("Remaining Credits: "+ rp.studentRecords[x].getRemainingCredits());
System.out.println("-------");
}
插件的应用程序很接近,但可能会失败,因为您的index.html中有javascript。 whitelist
阻止了许多开发人员。最简单的方法是将所有Javascript和CSS移动到他们自己的单独文件中。
除此之外,这是一个广泛应用的解决方案:
作为旁注,Cordova Tools 5.0.0(2015年4月21日)需要CSP
系统。对于 Phonegap Build ,这意味着自cli-5.1.1
(2015年6月16日)
将此添加到您的whitelist
config.xml
注意您的应用程序现在已不确定。由您来保护您的APP。
将以下内容添加到<plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" /> <!-- Required for iOS9 -->
index.html
注意您的应用程序现在已不确定。由您来保护您的APP。
此白名单工作表应该有所帮助
HOW TO apply the Cordova/Phonegap the whitelist system