Increasing page load time when using @font-face

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
It's nice to use custom fonts in webpages, rather than the classic web safe fonts. However, using them can sometimes slow down your page load time and this is because the font is downloaded on each page view. First, the page content is download and this is followed by the font

Anyway, I'm here to show one simple solution, using .htaccess.

Simply add this short code to your .htaccess file
Code:
<IfModule mod_headers.c>
Header unset ETag
Header unset Last-Modified
</IfModule>
FileETag None
<FilesMatch "\.(eot|woff|ttf|svg|)$">
Header unset Cache-control
Header set Expires "Wed, 28 Apr 2016 20:00:00 GMT"
</FilesMatch>

What this basically does is, after the visitors first visit, the font is stored on there computer until the set date so there is no need to re-download the font.

There are other ways of doing this, this is just the easiest in my opinion.




 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Haven't tried this out yet, but should come in handy.
Cheers for sharing this!
 

Shard

Member
Feb 16, 2013
52
9
So those webfonts work offline too? As in, for example in localhost with Internet Turned off.
 

Users who are viewing this thread

Top