javascript的加载方式,总得来说是在页面上使用script来声明,以及动态的加载这些方式,而动态的加载,在很多js库中都能够很好的去处 理,从而不至于阻塞其他资源的加载,并与其并行加载下来.这样的动态异步的加载方式罗列起来有:Ajax的方式.DOM Element Insert.Iframe.document.write.defer等等.这些都能够很好的处理js在加载的时候不会阻塞资源加载的问题,但是,js 的执行仍然会阻塞浏览器的渲染.或许这是不得不需要付出的代价,有没有一些方式去缓解…
延迟加载javascript,也就是页面加载完成之后再加载javascript,也叫on demand(按需)加载,一般有一下几个方法: What can your tired old page, once loaded and used and read, can do for your user? It can preload components needed by the next page, so when the users visit the next page, they hav…