I have a scenario in which a container HTML page is including most of the common JS frameworks like JQuery, AngularJS, Bootstrap. This page will then include other widgets in it through Ajax call using JQuery and if those widgets come with any of these common frameworks, the application/events of duplicated framework stopped working.
Now is there any way to prevent downloading of common frameworks from these widgets?
Can this be handled through RequireJS?
Just to get the idea:
if (!sessionStorage.isLoaded)
{
//load
var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", filename);
fileref.onload = function(){
sessionStorage.isLoaded = 1;
};
document.getElementsByTagName("head")[0].appendChild(fileref);
}
check for ie compatibility http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/
It's better off to unset sessionStorage.isLoaded beforeOnLoad :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.