3

When downloading a production copy of jQuery, next to the link it says that the file is 32K Minified & Gzipped. I get Minified but what do they mean by Gzipped?

Is it Gzipped by the webserver like Apache deflate?

update: found this website to see which resources are gzipped http://gzipwtf.com/

dev.e.loper
  • 35,446
  • 76
  • 161
  • 247

3 Answers3

3

When your browser sends a HTTP request to a web server, it can specify the Accept-Encoding field to indicate which compression schemas it supports:

GET /scripts/jquery.min.js HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, deflate

The server can then choose one of these schemas (but doesn't have to) and specify it in the response header:

HTTP/1.1 200 OK
Content-Encoding: gzip
etc.

So, if the web server is configured to gzip javascript files, and the browser supports it (the vast majority does), then the file will be "gzipped".

vgru
  • 49,838
  • 16
  • 120
  • 201
2

Yes, it uses an Apache module called mod_gzip:

http://sourceforge.net/projects/mod-gzip/

Which works (in principle) just like mod_deflate.

Kyle Hale
  • 7,912
  • 1
  • 37
  • 58
2

That download link is to a hosted file that you may hot-link to in your web pages. The file itself is minified JavaScript.

When the file requested from their hosting server by the browser, it is further compressed in transit using Gzip compression as specified in the content header. When the browser receives it, it gets inflated and stored in the browser's cache.

If you were to host the minified file on your own server it would not necessarily be compressed in transit as described unless you configured your server to use compression.

Dave Rager
  • 8,002
  • 3
  • 33
  • 52