I have web site and i have 100+ external javascript files, and it is loading very very slowly. Generally the files are not so big they are probably 100-2500 byte. Lode speed is connected from http requests (i think) ...

How can i optimize that ?

有帮助吗?

解决方案

Browsers only support a certain number of HTTP channels, number here.

So with 100+ files all your HTTP requests are queuing and slowing down loading of the page.

So, it is (generally) much more efficient to download one large file than lots of small files. So your best optimisation for above is to put all your Js files into one (or a few) large(ish) files.

其他提示

A small PHP script and some clever URL rewriting designed to speed up the loading of pages that use many or large css and javascript files.

RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1

full documentation

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top