getscript - how to detect external js file is already being included using jquery -


i have included external js file using getscript. however, include once. how can detect whether external file has been included using jquery? thanks.

this doesn't technically check if file has been loaded, can check object namespace defined within file.

say js file namespaced code using like:

var mynamespace = function(){   return {    some:'stuff'   }; }(); 

or style namespacing (ie jquery same thing) can check presence of mynamespace

so

if (typeof mynamespace == "undefined"){ // load script } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -