Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Created August 16, 2015 06:23
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 khanhtran3005/fae32f750ec8350bff64 to your computer and use it in GitHub Desktop.
Save khanhtran3005/fae32f750ec8350bff64 to your computer and use it in GitHub Desktop.
function loadStyleSheet(src) {
    if(document.createStyleSheet) {
       document.createStyleSheet(src);
    } else {
        var css;
        css         = document.createElement('link');
        css.rel     = 'stylesheet';
        css.type    = 'text/css';
        css.media   = "all";
        css.href    = src;
        document.head.appendChild(css);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment