Chaching Zeit ändern Google Web Fonts

Change Google Web Font Loader caching time

6. February 2020

Normally, the browser caching time of the Web Font Loader JavaScript is set to one hour. However, since Google Page Speed Insights criticize this as too short, one should take action here and try to increase the caching time.

 

Usually, you have no way to influence these settings when using external resources. However, there is a trick that helps with the Web Font Loader.

 

JavaScript
(function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
})();

The version number 1 is given in the marked line of the integration code. If a specific version number is selected here, the caching time is one year. The most recent version number can be found in Googles Developer Guide.

 

 

Attention

If you set this specific version, you will not benefit from automatic updates and will have to upgrade manually if necessary.

SIE KÖNNEN SICH BEI UNS BEDANKEN!

Sofern Ihnen der Artikel geholfen hat, können Sie sich mit wenig Aufwand revanchieren!

 

Bitte hinterlassen Sie uns eine positive Bewertung.

 

Falls Sie Fehler entdecken oder ein Artikel unvollständig ist, freuen wir uns über einen Kommentar.

Bewertung erstellen

Comments

Tell us what you think! Reply now

Your email address will not be published.