Webfont.js And Render Blocking Google Fonts
-
Hey Frank,
Love the new AO features ??
Just a suggestion for the new Google Fonts options. Webfont.js works but will almost always still cause the “Render Blocking” recommendation on PageSpeed Insights for the fonts it’s asynchronously loading. Rather than deal with those future 234,635,765 support requests about that, you might consider something like so:
<script>function loadCSS(e,t,n){"use strict";var o=window.document.createElement("link"),s=t||window.document.getElementsByTagName("script")[0];o.rel="stylesheet",o.href=e,o.media="only x",s.parentNode.insertBefore(o,s),setTimeout(function(){o.media=n||"all"})}loadCSS("insert-you-favorite-color-here");</script>
GPSI still doesn’t ‘get it’ with this sometimes, but does far more often than with webfont.js.
Be well,
AJ
- The topic ‘Webfont.js And Render Blocking Google Fonts’ is closed to new replies.