<small id='mdEsY'></small><noframes id='mdEsY'>

    1. <legend id='mdEsY'><style id='mdEsY'><dir id='mdEsY'><q id='mdEsY'></q></dir></style></legend>

      <i id='mdEsY'><tr id='mdEsY'><dt id='mdEsY'><q id='mdEsY'><span id='mdEsY'><b id='mdEsY'><form id='mdEsY'><ins id='mdEsY'></ins><ul id='mdEsY'></ul><sub id='mdEsY'></sub></form><legend id='mdEsY'></legend><bdo id='mdEsY'><pre id='mdEsY'><center id='mdEsY'></center></pre></bdo></b><th id='mdEsY'></th></span></q></dt></tr></i><div id='mdEsY'><tfoot id='mdEsY'></tfoot><dl id='mdEsY'><fieldset id='mdEsY'></fieldset></dl></div>

      <tfoot id='mdEsY'></tfoot>
      • <bdo id='mdEsY'></bdo><ul id='mdEsY'></ul>
    2. 提供 gzip 文件时使用什么“Content-Type"标头?

      时间:2023-08-01
        <bdo id='EoHpW'></bdo><ul id='EoHpW'></ul>
            <legend id='EoHpW'><style id='EoHpW'><dir id='EoHpW'><q id='EoHpW'></q></dir></style></legend>
            <i id='EoHpW'><tr id='EoHpW'><dt id='EoHpW'><q id='EoHpW'><span id='EoHpW'><b id='EoHpW'><form id='EoHpW'><ins id='EoHpW'></ins><ul id='EoHpW'></ul><sub id='EoHpW'></sub></form><legend id='EoHpW'></legend><bdo id='EoHpW'><pre id='EoHpW'><center id='EoHpW'></center></pre></bdo></b><th id='EoHpW'></th></span></q></dt></tr></i><div id='EoHpW'><tfoot id='EoHpW'></tfoot><dl id='EoHpW'><fieldset id='EoHpW'></fieldset></dl></div>
              <tfoot id='EoHpW'></tfoot>
              1. <small id='EoHpW'></small><noframes id='EoHpW'>

                  <tbody id='EoHpW'></tbody>

                本文介绍了提供 gzip 文件时使用什么“Content-Type"标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在提供我的 css/javascript 文件的 gzip 副本.根据教程,我在提供这些文件时将内容类型设置为 application/gzip.但是,chrome 似乎没有解压缩这些文件,并且对于 javascript 文件,我得到了很多非法字符"错误.如果我查看源代码,我仍然看到文件是压缩的,而不是未压缩的.

                I'm serving gzipped copies of my css / javascript files. As per a tutorial, I set the content-type as application/gzip when serving these files. However, chrome doesn't seem to un-gzip these files, and for the javascript files I get a lot of 'illegal character' errors. If I view source, I still see the files as compressed, rather than uncompressed.

                我的问题是,我应该为这些文件设置什么内容类型,以便浏览器将它们正确解释为 gzip 压缩的 css/js 文件并解压缩它们?如果我只设置了text/javascripttext/css,浏览器还能正确解释它们吗?

                My question is, what should I set as the content type for these files, in order for the browser to interpret them correctly as gzipped css / js files, and un-gzip them? If I just set text/javascript or text/css, will the browser still interpret them correctly?

                完整的响应标头:

                HTTP/1.1 200 OK
                x-amz-id-2: UIBkZT/MuFxsmn+3nVOzEO63rRY99l3traCbMExUgSdGHUrOIPtNp34h1+ujYKmt
                x-amz-request-id: 19346C9B01D8FC62
                Date: Mon, 12 May 2014 03:59:51 GMT
                Content-Encoding: gzip
                Last-Modified: Mon, 12 May 2014 02:24:54 GMT
                ETag: "561080b5e19f6daea2e74fd5a0623c79"
                Accept-Ranges: bytes
                Content-Type: application/x-gzip
                Content-Length: 5153
                Server: AmazonS3
                

                推荐答案

                响应中的压缩内容在Content-Encoding中指明.Content-Type 应该保持不变,也就是说,它应该反映被压缩的底层媒体类型.

                Compressed content in the response is indicated in the Content-Encoding. The Content-Type should remain the same, that is, it should reflect the underlying media type that is compressed.

                Content-Type: application/javascript
                Content-Encoding: gzip
                

                参见 14.11 内容编码 和 3.5 内容编码 的 RFC 2616 了解更多信息.

                See sections 14.11 Content-Encoding and 3.5 Content Codings of RFC 2616 for more information.

                这篇关于提供 gzip 文件时使用什么“Content-Type"标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:webRequest 侦听器看不到“cookie"、“referer"、“origin"等 下一篇:属性属性的 HTML 验证错误

                相关文章

                  <small id='GbH7P'></small><noframes id='GbH7P'>

                1. <tfoot id='GbH7P'></tfoot>
                  <legend id='GbH7P'><style id='GbH7P'><dir id='GbH7P'><q id='GbH7P'></q></dir></style></legend>
                  <i id='GbH7P'><tr id='GbH7P'><dt id='GbH7P'><q id='GbH7P'><span id='GbH7P'><b id='GbH7P'><form id='GbH7P'><ins id='GbH7P'></ins><ul id='GbH7P'></ul><sub id='GbH7P'></sub></form><legend id='GbH7P'></legend><bdo id='GbH7P'><pre id='GbH7P'><center id='GbH7P'></center></pre></bdo></b><th id='GbH7P'></th></span></q></dt></tr></i><div id='GbH7P'><tfoot id='GbH7P'></tfoot><dl id='GbH7P'><fieldset id='GbH7P'></fieldset></dl></div>

                      <bdo id='GbH7P'></bdo><ul id='GbH7P'></ul>