0

Has anyone encountered this message while trying to display a toast while using Helmet?

The toast still displays but, I'm not sure why the error is.

enter image description here

4

1 回答 1

0

您的浏览器似乎阻止了此操作,因为data:图像未在内容安全策略中列入白名单。CSP的img-src指令如下所示:

img-src 'self' https://cdnjs.cloudflare.com

它应该看起来像这样:

img-src 'self' https://cdnjs.cloudflare.com data:

您可以使用 Helmet 设置此策略,如下所示:

app.use(helmet.csp({
  directives: {
    // ...
    imgSrc: ["'self'", "https://cdnjs.cloudflare.com", "data:"]
  }
}))
于 2016-09-09T02:37:48.047 回答