JavaScript loading strategies

Author : lovecicy

一:压缩js代码(YUI Compressor 或者Gzip)。 二:推迟加载时间,将<script>标签放在</body>之前。 三:异步加载JS文件。 四:延时加载,在需要的时候加载JS文件。 五:只加载需要的文件,比如有些库会让你加载全部文件,实际上你需要的只是其中的一个文件。 六:你真的需要哪些美轮美奂的效果吗? By:Ara Pehlivanian From: JavaScript has a dark side to it that not many people are aware of. It causes the browser to stop everything that it’s doing until the script has been downloaded, parsed and executed. This is in sharp contrast to the other dependencies which g[Read More]