ios上的角度/离子iframe问题

mar*_*cel 4 angularjs ionic-framework

我在iPhone上的离子应用程序有问题.Ionic将此写入index.html:

<iframe src="gap://ready" style="display:none;">...</iframe>
Run Code Online (Sandbox Code Playgroud)

应用程序的控制台输出每秒循环此错误大约40次:

Refused to load gap://ready because it appears in neither the child-src directive nor the default-src directive of the Content Security Policy.
Run Code Online (Sandbox Code Playgroud)

我猜每次使用angular的dirtycheck工作时,都会抛出此错误.iframe来自何处以及如何摆脱iframe和错误?

mar*_*cel 10

解决方案,只需添加间隙:到以下元标记index.html:

<meta http-equiv="Content-Security-Policy" content="default-src * data: cdvfile: gap:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/>
Run Code Online (Sandbox Code Playgroud)

  • 这也解决了我在iOS 10上没有加载的phonegap条码扫描器插件的问题! (2认同)