Webmaster Forum

Webmaster Forum (http://www.v7n.com/forums/index.php)
-   Coding Forum (http://www.v7n.com/forums/forumdisplay.php?f=16)
-   -   <link rel=preload> Not Preloading Self Hosted Fonts (http://www.v7n.com/forums/showthread.php?t=429598)

SunEmbroidery 10-31-2018 05:26 PM

<link rel=preload> Not Preloading Self Hosted Fonts
 
I'm trying to preload fonts that are hosted on my site in the “fonts” folder. I received the following message in Google's Lighthouse:

Consider using <link rel=preload> to prioritize fetching late-discovered resources sooner.

/fonts/bowlbyone-regular-webfont.woff2(www.name of site.com)
1,380 ms
/fonts/raleway-light-webfont.woff2(www.name of site.com)
1,380 ms


I added the following code directly above the </header> on each html page:

<link rel="preload" href="/fonts/bowlbyone-regular-webfont.woff2" as="font">
<link rel="preload" href="/fonts/raleway-light-webfont.woff2" as="font">


But, I'm still receiving the Lighthouse message to preload the .woff2 fonts. Any suggestions? Thanks!

ScriptMan 11-01-2018 03:49 AM

You are using a relative path and it looks like the directions say to use an absolute path

PHP Code:

<link rel="preload" href="www.yousite.com/fonts/bowlbyone-regular-webfont.woff2" as="font"

I have zero experience doing this but that is my best guess.

SunEmbroidery 11-02-2018 08:56 AM

Adding the absolute link didn’t help. I haven’t implemented any caching on the site so it isn’t that.

SunEmbroidery 11-03-2018 05:50 PM

After reading Yoav Weiss’s "Preload: What is It Good For?" I added:

... type=“font/woff2” crossorigin> to the preload request and it worked.

ScriptMan 11-04-2018 04:46 AM

Quote:

Originally Posted by SunEmbroidery (Post 2333654)
After reading Yoav Weiss’s "Preload: What is It Good For?" I added:

... type=“font/woff2” crossorigin> to the preload request and it worked.

Good for you and posting the solution may help someone else.

Good job.


All times are GMT -7. The time now is 09:12 PM.

3.8.7