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.
(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.
Comments