0

I am developing a website.It has like 7-8 pages.I am willing to use font Open-Sans which is a custom font of Sans-Serif family.I read somewhere that using fonts through google api helps you in reducing the page loading time.But the problem is i have to apply javascript for loading the fonts from google on each page.Is there a way using which i can load the font once and use it in all the pages?

Shobhit_Geek
  • 591
  • 9
  • 22
  • 2
    why not link to it directly in your page header? – Eamonn Jul 12 '14 at 10:43
  • If I understand correctly, you want to cache the font file? Or, make your website use ajax to load pages. This way the font will never need to reload until it is refreshed. – CharliePrynn Jul 12 '14 at 10:44
  • @Eamonn : If i link it directly in my page head section through __ then too i have to load the same font in all the pages.The problem is , i am using the same font for all the pages and i want to load the font once and use it in all the pages. – Shobhit_Geek Jul 12 '14 at 11:06

1 Answers1

0

You don't have to worry about repetitive loading: external files are cached. Most certainly CSS and JS files are. See this question: you even have to actively force modern browsers to reload them. And as the Google font files are JS files, you can rest assured that your fonts are cached as well.

Why you still need to include the script tag in your head on every page, is because without it, the browser will 'think' that the cached file is not to be used again.

Community
  • 1
  • 1