Refused to apply inline style because it violates the following Content Security Policy directive

后端 未结 6 2361
心在旅途
心在旅途 2020-12-08 09:08

So, in about 1 hour my extensions failed hard.

I was doing my extension and it was doing what I pretended. I made some changes, and as I didnt liked I deleted them,

6条回答
  •  悲哀的现实
    2020-12-08 09:50

    As per http://content-security-policy.com/ The best place to start:

        default-src 'none'; 
        script-src 'self'; 
        connect-src 'self'; 
        img-src 'self'; 
        style-src 'self';
        font-src 'self';
    

    Never inline styles or scripts as it undermines the purpose of CSP. You can use a stylesheet to set a style property and then use a function in a .js file to change the style property (if need be).

提交回复
热议问题