Why is gzip compression with Internet Explorer not working?

前端 未结 4 1480
青春惊慌失措
青春惊慌失措 2020-12-14 13:39

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 fi

4条回答
  •  无人及你
    2020-12-14 14:06

    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

    • Internet Explorer may not decompress HTTP content when you visit a Web site

    • Vary with Care

    • IE 8 seems unable to display some Wikipedia Pages - application/x-gzip-compressed MIME type

    • Internet Explorer 6 does not display XHTML strict Web pages correctly

提交回复
热议问题