Skip to content

Instantly share code, notes, and snippets.

@alectoist
Created August 4, 2015 09:11
Show Gist options
  • Save alectoist/9d7119ca0544c39ad2eb to your computer and use it in GitHub Desktop.
Save alectoist/9d7119ca0544c39ad2eb to your computer and use it in GitHub Desktop.
How do I async loaded CSS
//Stolen from http://stackoverflow.com/questions/24020254/async-true-for-css-link-tag
var resource = document.createElement('link');
resource.setAttribute("rel", "stylesheet");
resource.setAttribute("href","path/to/cssfile.css");
resource.setAttribute("type","text/css");
var head = document.getElementsByTagName('head')[0];
head.appendChild(resource);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment