views:

240

answers:

2

Hello,

I just got around to installing mod_deflate on my server. I also added the following to my Website Optimizer in cPanel:

text/html text/plain text/xml text/css text/js text/javascript

Now, the site shows considerable improvement in loading time (almost 3x!), but ySlow is still giving me an "E" rating for "Compress Components with gZip". It shows 4 .js components not being Compressed.

The problem is that the whole website except the .JS components is being gZipped properly. Everything else, including the inline javascript, HTML and other MIME types have been Compressed. I've not added anything to the htaccess, since I think Website Optimizer takes care of it. But I'm still not able to figure out what the problem is?

Any ideas?

Thanks,

B.

A: 

Have you checked what MIME type the JavaScript is being served as? You listed text/javascript in the list of types to gzip, but sometimes JavaScript isn't served under that MIME type; it may be served under text/ecmascript, application/x-javascript, or might be getting a default type like text/plain. Browsers don't generally care what type is sent in the Content-Type, as it's the type listed in the <script> tag that they pay attention to, so the content type for your JavaScript files might be something odd.

Brian Campbell
Thanks for your reply. Nah, that doesn't seem to be the problem since all JS is served as text/javascript itself.
Bhavik
A: 

Bingo! Realized what the problem is. For anyone else who seems to be facing the same problem:

text/javascript MIME is obsolete. Changed it to application/javascript and it works live a charm! :)

Bhavik