Skip to content

Instantly share code, notes, and snippets.

@englishextra
Created October 1, 2016 19:36
Show Gist options
  • Save englishextra/d00e7046c9957199ff3e87af693f38be to your computer and use it in GitHub Desktop.
Save englishextra/d00e7046c9957199ff3e87af693f38be to your computer and use it in GitHub Desktop.
How can I check if a CSS file has been included already?
/*!
* How can I check if a CSS file has been included already?
* gist.github.com/englishextra/d00e7046c9957199ff3e87af693f38be
* stackoverflow.com/questions/18155347/how-can-i-check-if-a-js-file-has-been-included-already
* @param {String} h path string
* styleIsLoaded(h)
*/
var styleIsLoaded=function(h){var a=document.styleSheets||"";if(a)for(var b=0,d=a.length;b<d;b++)if(a[b].href==h)return!0;return!1};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment