85

到底JS文件的引入放置在头部好还是尾部好?-小象慢跑的博客

 6 years ago
source link: http://blog.51cto.com/13591336/2073123
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
统计工具说是将JS文件放置在body标签之后会提升加载速度。不过最终我们还是放置在了head标签里。这里就涉及到一个JS文件位置的选择。到底JS文件的引入放置在头部好还是尾部好?今天小编和大家探讨,JS文件到底该放置最好。  具体将引入的JS放在哪里与代码执行的顺序有关。网页文件的读取是从上到下的,如果将JavaScript文件放置在head当中,会先加载JS文件,之后再继续执行,那么此时,如果J

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK