Refused to apply inline style because it violates the following Content Security Policy directive: “style-src 'self'” modernizr

后端 未结 1 1821
谎友^
谎友^ 2021-01-03 03:16

I have created new asp.net mvc 5 project in visual studio 2015 professional And I have added meta tag in my layout for Content Security Policy as -



        
相关标签:
1条回答
  • 2021-01-03 03:31

    Apparently modernizr either injects a style element with some CSS properties, or else injects some style attributes; you can deal with it by changing your CSP policy this:

    <meta http-equiv="content-security-policy"
      content="default-src 'none'; script-src 'self';
      connect-src 'self'; img-src 'self';
      style-src 'self' 'sha256-CwE3Bg0VYQOIdNAkbB/Btdkhul49qZuwgNCMPgNY5zw=';" />
    
    0 讨论(0)
提交回复
热议问题