cordova内容安全策略给出登录问题

时间:2017-04-24 13:25:47

标签: javascript html cordova ssl

当我在index.html页面[这是一个登录表单]

上添加此行时

<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://codepush.azurewebsites.net/ data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

它只是没有进入下一个表单并在按下登录按钮后挂起。

index.html:60 Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' https://codepush.azurewebsites.net/ data: gap: https://ssl.gstatic.com 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

见下面的参考图片 - https://www.dropbox.com/s/qwr11xb03gpqn8t/Screenshot%202017-04-24%2018.53.24.png?dl=0

1 个答案:

答案 0 :(得分:0)

尝试所有。使用<meta http-equiv="Content-Security-Policy" content="default-src * ; style-src 'self' 'unsafe-inline'; script-src 'self' https: 'unsafe-inline' 'unsafe-eval' ">