Skip to content

Instantly share code, notes, and snippets.

@jedp
Created January 27, 2011 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedp/799455 to your computer and use it in GitHub Desktop.
Save jedp/799455 to your computer and use it in GitHub Desktop.
Gracefully handle the unavailability of Typekit
if (typeof Typekit != 'undefined') {
try {
Typekit.load({
active: function() {
// it worked. carry on ...
}
});
} catch(e) {
// probably want to fall back to no typekit
$('html').addClass('wf-inactive').removeClass('wf-loading');
}
} else {
// typekit js is unavailable; so set html to wf-inactive class
$('html').addClass('wf-inactive').removeClass('wf-loading');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment