-
-
Save alexcarpenter/9b8cd3f3f04add4d56016a718c28c614 to your computer and use it in GitHub Desktop.
Master Race Typekit Solution by Glen Maddern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<script> | |
if (window.localStorage && window.localStorage._tk_cache) { | |
document.documentElement.classList.add('wf-active'); | |
var script = document.createElement('script'); | |
script.innerHTML = localStorage._tk_cache + ";(function () {var timeout = setTimeout(function () {document.documentElement.classList.remove('wf-active');}, 300); Typekit.load({ async: false, active: function () { clearTimeout(timeout); }});})();"; | |
document.head.appendChild(script); | |
} | |
window._tk_onload = function () { | |
var req = new XMLHttpRequest() | |
req.addEventListener("load", function () { | |
window.localStorage._tk_cache = this.responseText; | |
}); | |
req.open("GET", "https://use.typekit.net/XXXXXXXXXXXXXXXX.js"); | |
req.send(); | |
}; | |
</script> | |
<script async src="https://use.typekit.net/XXXXXXXXXXXXXXXX.js" | |
onload="try { Typekit.load({ async: true, loading: window._tk_onload }) } catch (e) {}"></script> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment