Forum Moderators: phranque
One of the main ideas is a mouse over in the navigation.
When the user puts the mouse over a navigation link,
over the content area is a directroy of what is behind the link shown.
Just right now, there are small directory files loaded into an iframe. But this takes time.
I have now the idea to put all this small directories into the javascript.
The javascript would be about 200 kB long.
Much to long to deliver it uncompressed.
A first study shows, that GZIP would bring it down to 30 kB,
that's no problem, the current js has 24 kb.
So I aks now, what's the best way for compresseion?
Are there today browsers not able to work with compressed files?
I have read about something in Apache to deliver
my.js (when the browser can not decompress)
my.js.gz (when the browser can decompress)
What to do, to make this on Apache server?
This web site has about 40.000 visitors a month.
So I want, that I compress the javascript only at each upload and the server delivers the compressed javascript direct.
Maybe 4 updates a month, so only 4 times to compress on my computer instead of 40000 times on the server.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Encoding} .*gzip.*
RewriteRule ^/(.*)\.js$ /$1.js.gz [L]
RewriteRule ^/(.*)\.css$ /$1.css.gz [L]
AddEncoding x-gzip text.gz
I added this to the .htaccess
and put
test.js
test.js.gz
on the server.
After this, I made a page with
<script src=test.js>
The access log files of the server show,
that at my tests with MSIE 7, Crome, Firefox,
always the uncompressed test.js was delivered
instead of, like expected, test.js.gz
[mrclay.org...]