gpt4 book ai didi

javascript - 使用内容安全策略阻止 Internet Explorer 11 上的内联 JavaScript

转载 作者:行者123 更新时间:2023-11-29 23:51:32 25 4
gpt4 key购买 nike

是否可以使用 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 the X-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/

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