Skip to content

Instantly share code, notes, and snippets.

@anhtran
Forked from paulund/google-webfont-async.php
Created November 18, 2018 07:57
Show Gist options
  • Save anhtran/be475e5b42671ba3f28cbe6c8676f9ff to your computer and use it in GitHub Desktop.
Save anhtran/be475e5b42671ba3f28cbe6c8676f9ff 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