5

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?

hlovdal
  • 26,565
  • 10
  • 94
  • 165
chris
  • 20,791
  • 29
  • 77
  • 90

4 Answers4

17

Are you sending the correct headers?

You need to send the

Content-Encoding: gzip

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:-

header('Content-Encoding: gzip');
Mez
  • 24,430
  • 14
  • 71
  • 93
7

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.

Pat
  • 25,237
  • 6
  • 71
  • 68
0

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.

Steven Surowiec
  • 10,030
  • 5
  • 32
  • 37
  • 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 08:11
0

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:

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

And add application/xml as a content type mapping:

    AddType application/xml .xsl

References

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265