注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

百鬼夜行

身是菩提树,心如明镜台,时时勤拂拭,勿使惹尘埃。

 
 
 

日志

 
 

Why is gzip compression with Internet Explorer not working?  

2017-07-12 09:09:34|  分类: js原理及提醒记忆 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
https://stackoverflow.com/questions/1241822/why-is-gzip-compression-with-internet-explorer-not-working

My site is gzipped compressed, and it doesn't load properly in IE. It works fine in FF/Chrome, but in IE, the only thing that pops up is a box asking to download the .gz file which contains the html document for the page.

Is this normal? Do I have to turn off gzip?

asked Aug 6 '09 at 22:13
chris
6,717266182
1 
Which version of Internet Explorer? – Mez Aug 6 '09 at 22:24
   
IE 7. haven't tested on 6 or 8 yet – chris Aug 6 '09 at 22:31

Are you sending the correct headers?

You need to send the

de  >Content-Encoding: gzip
de>

header for IE to understand that it is gzipped (Firefox, et al are smart enough to detect this automatically - even though they shouldn't!)

In PHP, you can do this using:-

de  >header('Content-Encoding: gzip');
de>
answered Aug 6 '09 at 22:19
Mez
14.5k115686
3 
header("Content-Encoding: gzip"); – danamlund Aug 6 '09 at 22:21
   
thanks guys that was helpful – chris Aug 6 '09 at 23:58
7 
"Detecting this automatically" isn't legal. – EricLaw Jul 30 '10 at 18:35
Why is gzip compression with Internet Explorer not working? - 禅静 - 百鬼夜行

One thing to add - you should turn off gzip compression for IE6 pre-SP2. Before SP2, IE6 doesn't always read and cache gzipped content properly and you end up with mangled code.

You can identify an IE6 SP2 install by looking for "SV1" in the user-agent string.

answered Aug 12 '09 at 12:15
Pat
19.5k54158

I have seen problems when using gzip with Internet Explorer on a page that has flash on it. If your page has flash this may be why. I don't remember the cause and at the time we found it it was causing problems on a live site so we just disabled gzip for Internet Explorer to get around it.

answered Aug 6 '09 at 23:02
Steven Surowiec
6,03042534
1 
This is a valid comment, IE6 if it sees "Vary" header along with Content-Encoding as gzip it fails to retrieve the complete response. – shivaspk Jan 15 '13 at 8:11

The HTTP headers are the issue. If you have the gzip header along with one of the following:

  • Vary
  • Transfer Encoding: Chunked

one or both need to be removed.

This problem is more likely to occur on a computer that is running Apache HTTP Server because Apache HTTP Server can use chunked encoding on any kind of file. This includes static files such as a JavaScript file or a .gif file. When the problem that is described in this article occurs, the content that is stored in the Internet Explorer cache may be truncated or corrupted.

For XML, XHTML, and XSLT files, prevent parsing as text/html or text/xsl:

de  >    RewriteCond %{HTTP_ACCEPT} text\/html [OR]
    RewriteCond %{HTTP_ACCEPT} text\/xsl [OR]
    RewriteCond %{HTTP_ACCEPT} gif|jpeg|png$
    ReWriteRule .*\.(xsl|xslt)$ - [F]
de>

And add de >application/xmlde> as a content type mapping:

de  >    AddType application/xml .xslde>
  评论这张
 
阅读(14)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017