admin管理员组文章数量:1415111
The question fits in the title. I am not interested in what the spec remend but what the mix of browsers currently deployed support the best.
- Google Docs gzips their JS.
- The Google AJAX Libraries API CDN gzips JS.
- Yahoo gzips the JS for their YUI files.
- The Yahoo home page gzips their JS.
So I think that the answer to my question is yes, it is fine to gzip JS for all browsers. But you'll let me know if you disagree.
The question fits in the title. I am not interested in what the spec remend but what the mix of browsers currently deployed support the best.
- Google Docs gzips their JS.
- The Google AJAX Libraries API CDN gzips JS.
- Yahoo gzips the JS for their YUI files.
- The Yahoo home page gzips their JS.
So I think that the answer to my question is yes, it is fine to gzip JS for all browsers. But you'll let me know if you disagree.
Share Improve this question edited Mar 26, 2014 at 8:16 munity wiki2 revs, 2 users 100%
avernet
2 Answers
Reset to default 7If you gzip your .js
(or any other content), two problems may arise: 1. gzip increases the latency for unpressible files (needs time to press and unpress) 2. an older browser may not understand the gzipped content. To avoid problem 2, you should examine the Accept-Encoding and User-Agent or other parts of the HTTP request to guess if the browser supports gzip. Modern browsers should not have problems with gzippd content.
An excerpt from http://httpd.apache/docs/2.2/mod/mod_deflate.html: At first we probe for a User-Agent string that indicates a Netscape Navigator version of 4.x. These versions cannot handle pression of types other than text/html. The versions 4.06, 4.07 and 4.08 also have problems with depressing html files. Thus, we pletely turn off the deflate filter for them.
No, it's not. Firstly, the browser must declare that they accept gzip encoding as per Supercharging Javascript. On top of that, certain versions of IE6 have broken implementations, which is still an issue if they haven't been patched. More in The Internet Explorer Problem (with gzip encoding).
本文标签: httpWhen serving JavaScript filesis it safe to gzip it by defaultStack Overflow
版权声明:本文标题:http - When serving JavaScript files, is it safe to gzip it by default - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745195913a2647133.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论