Home > Web Front-end > JS Tutorial > Optimize web pages to quickly render our web pages_javascript techniques

Optimize web pages to quickly render our web pages_javascript techniques

WBOY
Release: 2016-05-16 19:11:52
Original
985 people have browsed it

1. The troubles we need to solve
A. Reduce the number of HTTP requests.
What are the benefits of reducing the number of HTTP requests:
Reduce the overhead of establishing the server and client and eliminating HTTP request and response headers
Decrease The server's process and thread overhead for HTTP connections, if possible, will also include the CPU overhead of GZIP compression.
B. Reduce the size of the requested file and reduce the network bandwidth occupied by the requested data.
C. Let the user See the desired results faster.
D. Improve the client rendering speed.
E Allow the browser to request more data at the same time.
F. Improve the server response speed.
G .Control the client Cache through versioning.



Quote
2. How to solve our troubles

A. How to reduce the number of HTTP requests
1. Merge JS files and CSS files.

2. Merge frame images and relatively less changed images into one, and complete rendering through CSS background cutting.
3. Properly use local Cache to cache JS/CSS /IMAGE.
4. Reasonably use UserData to cache JS files. FF users can request the server separately, which can solve the problem of 80% of users.
5. Merge JS and CSS into one file
The writing method is as follows :

                                                                                          🎜>                                                                                                                                                                                                                                window. innerHTML= "Legendary JS tester.If you see me, then JS also works";
                                                 
                                                                                                              Files referenced by JS and Style at the same time are all valid

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template