我正在使用 csp 标头保护我的页面。我设置了X-Content-Security-Policy
和X-Webkit-CSP
。为以下值:
default-src 'self';
object-src 'none';
frame-src 'self' *.youtube.com;
style-src 'self' https://ajax.googleapis.com;
script-src 'self' https://ajax.googleapis.com;
report-uri /csp_report
一切正常,但我在 chrome 中收到以下错误。我还没有在其他浏览器中测试它。
Refused to apply inline style because it violates the following Content
Security Policy directive: "style-src 'self' https://ajax.googleapis.com".
引用当前域上脚本中的一行,它试图插入一些包含内联样式的 HTML。有没有办法允许我在 script-src 中列入白名单的脚本执行此操作?对于托管在 ajax.googleapis.com 上的 jquery,我遇到了同样的错误。