Question

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 ?

Était-ce utile?

La solution

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.

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top