My Links
EX0-101 Exam Questions Quality link building cell phones accessories Call of Duty 4 Servers Ventrilo Server Ventrilo Hosting Teamspeak Server Online Conversion Website Builder Laptop Carrying Cases Driver Detective London Ontario Web Design manticore technology blog Personal Trainer Website DesignRandom Articles
-
Microsoft issues SQL Azure, CEP platform previews
Microsoft on Tuesday released technology previews... -
Judge vacates three of four charges against SF network admin Terry Childs
A San Francisco Superior Court judge has... -
Robotic arm fetches Japanese cargo ship at space station
The International Space Station crew used the... -
FAQ: What the Dell-Perot merger means for the IT industry
The Dell-Perot deal accelerates Dell’s push... -
After year of trouble, Big Bang machine breaks world record
After a year in drydock, CERN's Large Hadron...
| Combining Javascript & CSS |
|
|
|
| Written by Joo Trans |
| Thursday, 13 August 2009 19:14 |
|
Take for example the following URLs: http://www.mysite.com/javascript/prototype.js You can combine all these files to a single file by simply changing the URL to: The script will intercept the attempt to retrieve something from the javascript directory and will notice that you want to fetch multiple files at once. It will then concatenate the requested files, compress it and send it as one to the browser. onfigurating this script is easy. First you need to download ands ave as combine.php file. By default this script look in the javascript and css directory in the root of your website, but if you are currently using different directories you can change these values at the top of the combine.php script. Upload the combine.php script to the root of your website. Secondly you need to create a cache directory that is writable by the web server. Again, by default this script will look for the cache directory in the root of the website, but you can change this in the combine.php script. Finally you need to add the following code into your .htaccess file. RewriteEngine On Note: if your preexisting .htaccess file already uses URL rewriting you do not need to add the first two lines. You can simply add the last two lines to the bottom of the .htaccess file. |



Compressing the files will decrease the size of the data that needs to be transferred, it does not solve the problem that the browser can only download a limited number of files at the same time. If you have many different files that need to be loaded the browser will not optimally use the bandwidth it has access to.