preloading font with rel preload

前端 未结 5 2050
予麋鹿
予麋鹿 2021-02-05 01:46

I am preloading a font using the HTML tag with the rel attribute set to preload as captured in the snippet below;

<         


        
5条回答
  •  温柔的废话
    2021-02-05 02:34

    I kept getting the warning when trying to load preload a google font.

    Turns out I was missing the fact that the font was being loaded as a style from google. I solved this by setting the as="style' and then using rel="stylesheet preload prefetch".

    See code example below:

    
    

    Happy coding =)

提交回复
热议问题