JavaScript Get all Loaded Scripts [duplicate]

旧巷老猫 提交于 2019-12-04 06:41:16

getElementsByTagName should get you started:

var scripts = document.getElementsByTagName('script');
// TODO: loop and read the src attribute

I am not sure exactly what you are trying to do but it sounds as if you are wanting one .js file to instead of many. I think you would be making more work for yourself to do that in a script. Just view the source for all of the script files and append then to one file. Save that then call that file as your src.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!