R3Z*_*3Z4 5 html iframe twitter-bootstrap content-security-policy
我想在 html 中使用 iframe 但出现此错误:
拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script-src 'unsafe-eval' 'self'”。启用内联执行需要“unsafe-inline”关键字、哈希值(“sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE=”)或随机数(“nonce-...”)。
我的代码:
<iframe src="test.com" height="200" width="300" title="Iframe Example"></iframe>
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个错误提前谢谢
iframe 与它无关,你有一个像<script>...</script>HTML 代码一样的内联脚本。因此你有选择:
'unsafe-inline'到指令中script-src(不安全的方式)'nonce-value''hash-value' 'self'令牌允许范围。