Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vladimirmyshkovski/4759743679be4ee3ab42a9384595198d to your computer and use it in GitHub Desktop.
Save vladimirmyshkovski/4759743679be4ee3ab42a9384595198d to your computer and use it in GitHub Desktop.
Async load css
<script>
z = document.getElementsByTagName('link').length
for (i = 0; i < z; i++) {
function loadStyleSheet(i){
if (document.createStyleSheet) document.createStyleSheet(i);
else {
var stylesheet = document.createElement('link');
stylesheet.href = i;
stylesheet.rel = 'stylesheet';
stylesheet.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(stylesheet);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment