拒绝加载样式表,因为它违反了以下内容安全策略指令:“style-src'self''unsafe-inline'”

问题描述 投票:3回答:1

我正在尝试加载使用第三方工具创建的外部弹出窗体。我一直收到有关CSP违规的错误。事情是我可以在本地正确加载它们,只有当我在提供商的服务器上部署它们时才会阻止它们。我不知道这些政策来自哪里,因为我没有在.htaccess文件中定义任何内容(带有codeigniter的PHP Web应用程序)我检查了所有相关的答案,但没有任何对我有用。

Refused to load the script because it violates the following Content Security Policy directive

because it violates the following Content Security Policy directive: "style-src 'self'"

我也尝试了几个版本的<meta http-equiv="Content-Security-Policy",但再次没有运气。

enter image description here

html css content-security-policy
1个回答
-1
投票

您在元标记中缺少style-src。

<meta http-equiv="Content-Security-Policy" content="style-src 'self' https://domaingoeshere.com/css/fonts.css 'unsafe-inline' 'unsafe-eval'">
© www.soinside.com 2019 - 2024. All rights reserved.