Home  >  Article  >  Web Front-end  >  Compress page elements_html/css_WEB-ITnose

Compress page elements_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:55:02938browse

Reduce page response time by compressing HTTP response content. Starting from HTTP/1.1, the web client uses the Accept-Encoding header in the HTTP request to indicate the supported compression type, such as: Accept-Encoding: gzip, deflate.

If the Web server checks the Accept-Encoding header , it will use the method supported by the client to compress the HTTP response, and will set the Content-Encoding header, such as: Content-Encoding: gzip.

Gzip is currently the most popular and effective compression method. Other methods such as deflate are less effective and not popular enough. With Gzip, content can typically be reduced by 70%.

The Web server determines whether to compress based on the file type. Most websites compress HTML files. But it's also worth compressing script files and stylesheets. In fact, it is worthwhile to compress task text information, including XML and JSON.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn