Created
August 4, 2015 09:11
-
-
Save alectoist/9d7119ca0544c39ad2eb to your computer and use it in GitHub Desktop.
How do I async loaded CSS
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
//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