【发布时间】:2020-11-12 17:07:31
【问题描述】:
我刚刚开始在 Chrome 上通过嵌入的 youtube 视频看到这个(86.0.4240.193 - 最近更新,这可能就是我刚刚看到这个的原因) - 这些只是“报告”,所以视频仍然显示,但只有 100 个的错误不可能是正确的!这就是我所看到的:
[Report Only] Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'strict-dynamic' 'unsafe-inline' https: 'report-sample' 'nonce-t9IE7nI2leo7qKxsm7d80g=='".
这是我的 iFrame --
<iframe id="video-iframe" width="500" height="281" src="https://www.youtube.com/embed/HIDDENVIDEO" frameborder="0" allowfullscreen ></iframe>
我无法弄清楚 CSP 应该是什么——我发现这是一个显然解决了他们的问题的 CSP——
<iframe id="video-iframe" width="500" height="281" src="https://www.youtube.com/embed/HIDDENVIDEO" frameborder="0" allowfullscreen csp="script-src 'self' https://www.google-analytics.com/ https://www.youtube.com/ https://s.ytimg.com/; object-src 'self'; child-src https://www.youtube.com/* https://s.ytimg.com/"></iframe>
没那么多——我只是看到:拒绝显示....
非常感谢任何帮助。
我刚刚检查了developers.google.com/youtube/iframe_api_reference#Examples 页面,我看到了同样的事情——这肯定不应该发生,对吧?
【问题讨论】:
标签: content-security-policy youtube-iframe-api