当我加载 Google 的托管jquery.min.js
时,它不会返回 gzipped:
请求标头
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
响应标头
Age:262255
Cache-Control:public, max-age=31536000
Content-Length:91668
Content-Type:text/javascript; charset=UTF-8
Date:Fri, 11 Nov 2011 13:06:19 GMT
Expires:Sat, 10 Nov 2012 13:06:19 GMT
Last-Modified:Thu, 22 Sep 2011 14:12:07 GMT
Server:sffe
Vary:Accept-Encoding
X-Content-Type-Options:nosniff
X-XSS-Protection:1; mode=block
有趣的是,确实:jquery-ui.min.js
请求标头
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
响应标头
Cache-Control:private, x-gzip-ok="", max-age=31536000
Content-Encoding:gzip
Content-Length:52140
Content-Type:text/javascript; charset=UTF-8
Date:Mon, 14 Nov 2011 13:55:50 GMT
Expires:Mon, 14 Nov 2011 13:55:50 GMT
Last-Modified:Thu, 22 Sep 2011 14:12:07 GMT
Server:sffe
Vary:Accept-Encoding
X-Content-Type-Options:nosniff
X-XSS-Protection:1; mode=block
这是怎么回事?
我发现一篇声称谷歌无视Accept-Encoding
并User-Agent
决定是否压缩的文章。这并不能解释为什么 Mac OS X 上最新的 Safari 和 Chrome 会获得未压缩的 jQuery(和压缩的 jQuery UI)。