Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 10-31-2018, 05:26 PM
SunEmbroidery's Avatar
SunEmbroidery SunEmbroidery is offline
Contributing Member
 
Join Date: 04-11-08
Location: Seaville, NJ
Posts: 85
iTrader: 0 / 0%
<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!
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 11-01-2018, 03:49 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 13,440
iTrader: 4 / 100%
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.

Last edited by ScriptMan; 11-01-2018 at 03:52 AM.
 
Reply With Quote
  #3  
Old 11-02-2018, 08:56 AM
SunEmbroidery's Avatar
SunEmbroidery SunEmbroidery is offline
Contributing Member
 
Join Date: 04-11-08
Location: Seaville, NJ
Posts: 85
iTrader: 0 / 0%
Adding the absolute link didn’t help. I haven’t implemented any caching on the site so it isn’t that.
 
Reply With Quote
  #4  
Old 11-03-2018, 05:50 PM
SunEmbroidery's Avatar
SunEmbroidery SunEmbroidery is offline
Contributing Member
 
Join Date: 04-11-08
Location: Seaville, NJ
Posts: 85
iTrader: 0 / 0%
After reading Yoav Weiss’s "Preload: What is It Good For?" I added:

... type=“font/woff2” crossorigin> to the preload request and it worked.
 
Reply With Quote
  #5  
Old 11-04-2018, 04:46 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 13,440
iTrader: 4 / 100%
Quote:
Originally Posted by SunEmbroidery View Post
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.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 04:50 AM.
Powered by vBulletin
Copyright © 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC