Skip to content

Instantly share code, notes, and snippets.

@paulund
Last active January 25, 2023 11:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulund/64507100a80381de6e67b28812d0b6c2 to your computer and use it in GitHub Desktop.
Save paulund/64507100a80381de6e67b28812d0b6c2 to your computer and use it in GitHub Desktop.
Javascript tag to load google web font async
<script type="text/javascript">
WebFontConfig = {
google: { families: [ 'Roboto' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
// ]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment