Home > Article > Web Front-end > How to dynamically add js files under IE_javascript skills
Here we only discuss the browsing situation that supports parallel downloading, which can be roughly divided into two types. One is executed in the order of adding to the DOM tree, and the other is executed in the order of download completion; in this way, if there are dependencies between js files , and is executed in the order of downloading, and an error will be reported if there is no cache (usually an error will be reported for the first execution, and http returns status 200. If the cache is not disabled and the http status is 304, no error will be reported. )
And IE executes the js code in the order in which the http download is completed. First look at the following code:
可以看出加载的3个js文件是并行下载的。
对于其它浏览器有动态加载js文件的并行下载和顺序执行问题的情况,目前还没有相对完美的解决方案(如果有了请指教一下。。),单从这个方面,个人觉得ie的这个onreadystatechange事件方案相对好些。