How to load a web browser

 

1. When we in the browser address bar and press Enter to enter the link, the browser will initiate a request to the server, the server will respond after receiving the request to return a html file, this is the html file to load web pages

2. After the first browser to get the html file to load html tags, meta and then find we set and introduced in the head tag html tags in css

3. Load css file, the browser will initiate a request to the server, returns css file server receives the request, and load it

4. Next, the browser will start to load the code in the body tag, that is, began to render dom elements, as well as their styles (this time has been to get css files), if present in the body in the picture, the browser will initiate a request to the server to get the picture, but this picture is requested to take time, the browser will not load images and other finished, but continues to load the code below

5. After you take a picture, the picture if the impact to the back of the layout elements, you will reload render dom element behind the pictures

6. When the browser to find the script tag, it will begin loading js, in fact, this step is not necessarily a step 6, possibly in step 3, depending on the script tags in the code, usually we write the script tag in the body below, and why? Js execution because of fast (resolved directly by the browser), and the loading speed is very slow, if your js size too large, it will affect the load time. If you are writing under css js, then prior to loading dom element because the browser to load your js not to load your dom element, resulting in a blank page long. Think about it, you open a page, for a long time are not open, you will wait?

7. If there are operations in js page, change the layout of the time, then dom element, again, loaded, its style must follow the load

8. When the above code is executed, the browser find the end tag html, that </ html> When this page finished loading it

 

Load a web page is not too much trouble? Our Internet when a web page whizzing came out, in fact, very troublesome

So we must not only learn to write code, we must learn how to improve the pages load faster

 

Guess you like

Origin www.cnblogs.com/woywan/p/12619788.html