资源解释为字体,但使用 NodeJS 以 MIME 类型 font-woff 传输

Resource interpreted as Font but transferred with MIME type font-woff with NodeJS

当我 运行 我的应用程序时,我在 Chrome 中收到 Resource interpreted as Font but transferred with MIME type font-woff 警告。我知道这是一个常见错误,并且有很多 post 围绕同一问题。

我在 运行 我的 Web 应用程序中使用 NodeJS 和 ExpressJS,提供的大多数解决方案都适用于 IIS 或 ASP.NET。

我查看了以下链接

  1. Link One
  2. Link Two
  3. Link Three

警告仅在 chrome 浏览器中出现。

Resource interpreted as Font but transferred with MIME type font-woff: "data:font-woff;base64,d09GRgABAAAAADV4ABMAAAAAVVAAAQAAAAAAAAAAAAAAAAAAAAAAA…0RofyBQ0TTUkwj7OhEtUMmyHSjGSOTuWY2rI32PdNJPiQZL3TSQq4+STRSagAAAAFVQS0vAAA=". jquery.js:1083
(anonymous function) jquery.js:1083
assert jquery.js:895
Sizzle.setDocument jquery.js:1082
(anonymous function) jquery.js:2556
(anonymous function) jquery.js:2611
(anonymous function) jquery.js:34
(anonymous function)

请帮忙

确保在使用 data-uris 时使用完整的 "type/encoding" mime 类型字符串:

data:text/html;base64,.......
data:image/png;base64,.......
data:application/font-woff;base64,.......

在这种情况下,您缺少 "application" 类型指示。