是否可以使用 ASP.NET WebForm 上的 CSP 阻止 Internet Explorer 11 上的内联 JavaScript?我知道 IE 11 不支持内容安全策略级别 2,但它支持级别 1.0。我尝试了很多方法,但没有明确的答案。我试过了:
- Response.AddHeader("X-Content-Security-Policy", "script-src 'none'");
- Response.AddHeader("X-Content-Security-Policy","script-src 'self'");
- Response.AddHeader("Content-Security-Policy", "script-src 'self'");
它不工作。
谢谢! 阿尔伯特·托雷斯
最佳答案
参见 here - IE 11 仅提供部分支持。
Partial support in Internet Explorer 10-11 refers to the browser only supporting the
sandbox
directive by using theX-Content-Security-Policy
header
但是,您可以试试这个 sandbox
指令。 Description here :
Enables a sandbox for the requested resource similar to the iframe sandbox attribute. The sandbox applies a same origin policy, prevents popups, plugins and script execution is blocked. You can keep the sandbox value empty to keep all restrictions in place
例如
X-Content-Security-Policy: sandbox
关于javascript - 使用内容安全策略阻止 Internet Explorer 11 上的内联 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42704605/