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
Post a Comment