首页 > 解决方案 > 如何根据浏览器仅预加载所需的类型(woff vs woff2)?

问题描述

我正在使用以下react-helmetwoff代码,我看到这两个woff2文件都是由 Firefox 预加载的(仅需要它是低效woff2的)。

正常的Firefox会同时加载吗?如何告诉浏览器只预加载所需的文件?

<Helmet
  link={[
    {
      rel: "preload",
      href: "/static/media/open-sans-latin-400.347639ec.woff",
      as: "font",
      type: "font/woff",
      crossOrigin: "anonymous",
    },
    {
      rel: "preload",
      href: "/static/media/open-sans-latin-400.f57a62e9.woff2",
      as: "font",
      type: "font/woff2",
      crossOrigin: "anonymous",
    },
  ]}
/>

标签: htmlreactjspreload

解决方案


推荐阅读