1. The order of IE downloads is from top to bottom, and the order of rendering is also from top to bottom. Downloading and rendering are performed simultaneously.
2. When rendering to a part of the page, all parts above have been downloaded (not all associated elements have been downloaded).
3. If you encounter a semantic interpretive tag embed file (JS script, CSS style), then the IE download process will enable a separate connection for downloading.
4. After the download of the style sheet is completed, it will be parsed with all the style sheets downloaded previously. After the parsing is completed, all previous elements (including those that have been rendered before) will be re-rendered.
5. If there is any redefinition in JS and CSS, the later definition function will override the previous definition function.
Loading of JS1. Cannot download and parse in parallel (blocking download).
2. When JS is referenced, the browser sends a js request and will wait for the return of the request. Because the browser needs a stable DOM tree structure, it is very likely that there is
The code directly changes the DOM tree structure, such as using document.write or appendChild, or even directly using location.href for jumps. In order to prevent JS repairs from occurring, the browser
To modify the DOM tree, it is necessary to rebuild the DOM tree, so it will block other downloads and renderings.
How to speed up HTML page loading1. Page Weight Loss:
a. The weight of the page is the most important factor affecting the loading speed.
b. Delete unnecessary spaces and comments.
c. Move inline script and css to external files.
d. You can use HTML Tidy to lose weight for HTML, and you can also use some compression tools to lose weight for JavaScript.
2. Reduce the number of files:
a. Reducing the number of files referenced on the page can reduce the number of HTTP connections.
b. Many JavaScript and CSS files can be merged and it is best to merge them. Caibangzi has merged their JavaScript. functions and Prototype.js into a base.js file.
3. Reduce domain name query:
a. DNS query and parse domain names also consume time, so we need to reduce the reference to external JavaScript, CSS, pictures and other resources. The less you use different domain names, the better.
4. Cache reused data:
a. Cache reused data.
5. Optimize the loading order of page elements:
a. First load the content originally displayed on the page and the JavaScript and CSS related to it, and then load HTML-related things, such as those that are not displayed on the original pictures, flash, videos, etc., and then load them.
6. Reduce the number of inline JavaScript:
a. The browser parser will assume that inline JavaScript will change the page structure, so using inline JavaScript is expensive.
b. Do not use document.write(), a method of outputting content, use modern W3C DOM methods to process page content for modern browsers.
7. Use modern CSS and legal tags:
a. Use modern CSS to reduce labels and images. For example, using modern CSS+ text can completely replace some text-only pictures.
b. Use legal tags to avoid error correction and other operations when the browser parses HTML. You can also use HTML Tidy to lose weight for HTML.
8. Chunk your content:
a. Do not use nested tables, but non-nested tables or divs. Decompose the layout of the table based on large chunks of nested tables into multiple small tables, so you don’t need to wait until the entire page (or large table) content is loaded before it is displayed.
9. Specify the size of the image and table:
a. If the browser can immediately determine the size of the image or table, it can immediately display the page without re-doing some layout arrangement.
b. This not only speeds up the display of the page, but also prevents some improper changes in the layout after the page is loaded.
c. image uses height and width.
HTML page loading and parsing process1. The user enters the URL (assuming it is an html page and it is the first time you access it), the browser issues a request to the server, and the server returns the html file.
2. The browser starts loading the html code and finds that there is a <link> tag in the <head> tag referencing the external CSS file.
3. The browser issues a request for the CSS file, and the server returns the CSS file.
4. The browser continues to load the <body> part of the code in the html, and the CSS file has been obtained, so you can start rendering the page.
5. The browser found a <img> tag in the code that referenced an image and made a request to the server. At this time, the browser will not wait until the image is downloaded, but will continue to render the subsequent code.
6. The server returns the image file. Since the image occupies a certain area, it affects the arrangement of the subsequent paragraphs, so the browser needs to go back and re-render this part of the code.
7. The browser found a <script> tag containing a line of Javascript code, and run it quickly.
8. The Javascript script executes this statement, which commands the browser to hide a <style>(style.display=none) in the code. It's a pity, suddenly there is such an element missing, and the browser has to re-render this part of the code.
9. Finally, I waited for the arrival of</html>, and the browser burst into tears...
10. Wait, it’s not over yet. The user clicked the skinning button in the interface, and Javascript asked the browser to change the CSS path of the <link> tag.
11. The browser gathered everyone here, everyone packed their luggage, we have to do it again... The browser requested a new CSS file from the server and re-rendered the page.