gpt4 book ai didi

content-security-policy - 如何修复 "Content Security Policy - contains an invalid source"错误?

转载 作者:行者123 更新时间:2023-12-03 19:00:04 51 4
gpt4 key购买 nike

我收到这个错误,我不知道为什么,我包含的脚本有效?
并且错误仅在我加载子页面时出现。不是在我加载起始页时。
那么我做错了什么?

The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline' 'unsafe-eval' https://checkout.dibspayment.eu https://www.google-analytics.com https://maps.google.com;">
任何输入都非常感谢,谢谢。

最佳答案

And the error only shows up when I load a subpage. Im getting this error and I don´t know why
The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.


这不是错误,只是警告您的浏览器不支持 'strict-dynamic' token 。 (猜你用的是 Safari)。
我猜是 子页面是一些 Google 的 iframe(oAuth2、reCaptcha 等)。该 iframe 发布它自己的 CSP,其中包含 'strict-dynamic' token ,此 CSP 是在浏览器中创建的 backward compatibility模式(谷歌使这样)。
这是来自第三方 CSP 的警告,而不是您的警告。

the scripts that I have included works?


您的父页面有自己的 CSP 允许脚本。嵌套浏览上下文(iframe)的 CSP 不影响父页面(除了 frame-ancestors 指令)。

So what Im I doing wrong?


没有。这是内容安全策略的预期定期工作。
每个浏览上下文都可以有自己的 CSP。但是所有警告都会流向一个浏览器控制台,这是一种误导。

关于content-security-policy - 如何修复 "Content Security Policy - contains an invalid source"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65094328/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com