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

后端 未结 6 2363
心在旅途
心在旅途 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:48

    As the error message says, you have an inline style, which CSP prohibits. I see at least one (list-style: none) in your HTML. Put that style in your CSS file instead.

    To explain further, Content Security Policy does not allow inline CSS because it could be dangerous. From An Introduction to Content Security Policy:

    "If an attacker can inject a script tag that directly contains some malicious payload .. the browser has no mechanism by which to distinguish it from a legitimate inline script tag. CSP solves this problem by banning inline script entirely: it’s the only way to be sure."

提交回复
热议问题