我是否正确使用 X-Content-Security-Policy?
Am I using X-Content-Security-Policy correctly?
我正在尝试使用我的 Internet Explorer 内容安全策略
这是我的内容安全策略:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
这是我为 X-Content-Security-Policy 添加的内容
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'">
当我使用 MS Edge、Firefox 或 Chrome 打开我的文档时,我看到了大量内联样式警告(和其他警告)。但是我在 IE 中什么也看不到。我仍然可以在 IE 的页面上 运行 脚本,这在我提到的其他浏览器上无法做到(并且想阻止)。
所以这让我想知道:我是否正确使用了 X-Content-Security-Policy 元标记?如果没有,我该如何修复我的标签?另外,我在哪里可以找到 X-Content-Security-Policy 的文档?我在 X-Content-Security-Policy 上搜索过……我什么也没找到。出现的东西是针对 Content-Security-Policy
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'"><meta http-equiv="Content-Security-Policy" content="default-src 'self'">
<script src="./jquery-3.3.1.min.js" type="text/javascript"></script>
<script>
alert('boo');
</script>
</head>
<body>
Hello World
</body>
</html>
CSP 仅在 IE10-11 中得到部分支持。你可以在browser compatibility, it doesn't support <meta>
element in IE. And partial support means it only supports the 'sandbox' directive by using the X-Content-Security-Policy header. For more details, you can also check .
中看到
我正在尝试使用我的 Internet Explorer 内容安全策略
这是我的内容安全策略:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
这是我为 X-Content-Security-Policy 添加的内容
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'">
当我使用 MS Edge、Firefox 或 Chrome 打开我的文档时,我看到了大量内联样式警告(和其他警告)。但是我在 IE 中什么也看不到。我仍然可以在 IE 的页面上 运行 脚本,这在我提到的其他浏览器上无法做到(并且想阻止)。
所以这让我想知道:我是否正确使用了 X-Content-Security-Policy 元标记?如果没有,我该如何修复我的标签?另外,我在哪里可以找到 X-Content-Security-Policy 的文档?我在 X-Content-Security-Policy 上搜索过……我什么也没找到。出现的东西是针对 Content-Security-Policy
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'"><meta http-equiv="Content-Security-Policy" content="default-src 'self'">
<script src="./jquery-3.3.1.min.js" type="text/javascript"></script>
<script>
alert('boo');
</script>
</head>
<body>
Hello World
</body>
</html>
CSP 仅在 IE10-11 中得到部分支持。你可以在browser compatibility, it doesn't support <meta>
element in IE. And partial support means it only supports the 'sandbox' directive by using the X-Content-Security-Policy header. For more details, you can also check