【发布时间】:2019-05-29 23:38:55
【问题描述】:
我在浏览器控制台上收到错误'Refused to load the stylesheet 'https://xxx.xxxxxxxxx.com/web_app_assets/css/font-awesome/css/font-awesome.min.css' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' https://fonts.googleapis.com".'
我在 .htaccess 中有以下设置 - Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com"
我们为同一网站提供 Web 视图和移动视图。如果网站通过移动浏览器加载,我们会重定向到移动域(指向同一个网站文件夹)并且我们只加载移动视图,那时我在控制台中遇到上述错误,并且 CSS 和 JS 不加载。
【问题讨论】:
-
不,不是,它在网络域上运行良好,但在移动浏览器中打开后无法在移动域上运行
标签: javascript css .htaccess content-security-policy