内容安全策略错误,但元标记包含URL [英] content security policy error, but meta-tag includes URL
本文介绍了内容安全策略错误,但元标记包含URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我收到这样的错误?
Why am I receiving errors like this?
Refused to load the script 'http://maps.googleapis.com/maps/api/js?v=3&sensor=false'
because it violates the following Content Security Policy directive:
"script-src 'self' *.googleapis.com 'unsafe-inline' 'unsafe-eval'".
我的元标记:
<meta http-equiv="Content-Security-Policy"
content="default-src *; style-src 'self' *.googleapis.com 'unsafe-inline'; script-src 'self' *.googleapis.com 'unsafe-inline' 'unsafe-eval'">
推荐答案
好像我需要显式的URI方案。这项工作:
Seems like I needed explicit URI-scheme. This work:
<meta http-equiv="Content-Security-Policy"
content="default-src *;
script-src 'self' 'unsafe-inline' 'unsafe-eval'
127.0.0.1:*
http://*.gstatic.com
http://*.googleapis.com
https://*.gstatic.com
https://*.googleapis.com
;
style-src 'self' 'unsafe-inline'
127.0.0.1:*
http://*.gstatic.com
http://*.googleapis.com
https://*.gstatic.com
https://*.googleapis.com
">
这篇关于内容安全策略错误,但元标记包含URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文