Last active
October 1, 2016 19:34
-
-
Save englishextra/403a0ca44fc5f495400ed0e20bc51d47 to your computer and use it in GitHub Desktop.
How can I check if a JS file has been included already?
This file contains hidden or 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
/*! | |
* How can I check if a JS file has been included already? | |
* gist.github.com/englishextra/403a0ca44fc5f495400ed0e20bc51d47 | |
* stackoverflow.com/questions/18155347/how-can-i-check-if-a-js-file-has-been-included-already | |
* @param {String} s path string | |
* scriptIsLoaded(s) | |
*/ | |
var scriptIsLoaded=function(s){for(var b=document.getElementsByTagName("script")||"",a=0;a<b.length;a++)if(b[a].getAttribute("src")==s)return!0;return!1}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment