What has the browser experienced from inputting the URL to the completion of page loading/A complete URL parsing process is introduced in detail

1. Briefly describe what has happened in the browser from entering the URL to the completion of page loading

Enter the url address in the address bar of the browser, and first perform url resolution on the client.
The browser will first check its own cache. If there is a corresponding resolution record in the browser cache, the result will be returned directly.
If the browser does not have a cache, the computer will check the local The cache of the operating system, if there is a record, directly returns the result (host file)
. If the IP address of the domain name is not cached locally, it is necessary to initiate a query request to the root domain name server, top-level domain name server, and authoritative domain name server in a recursive or iterative manner. Until an IP address is returned to the browser.
A TCP connection is then established based on that IP address .
The client sends an HTTP request, the server returns a message, and closes the TCP connection.
After the browser kernel gets the corresponding content,
it parses html and css to build DOM Tree and CSSOM Tree respectively,
and then these two are merged into Render Tree.
Then lay out the Render Tree, draw the Render Tree, and draw the page pixel information.
The browser will send the information of each layer to the GPU, and the GPU will synthesize the layers and display them on the screen.
Rendering is complete.

2. Process Analysis

2.1, domain name resolution

The browser will analyze the url we input and
mainly divide it into the following parts: protocol, network address, and resource path. The
network address indicates which computer on the connected network, which can be a domain name or IP address, and can include a port number
protocol . It is the way to obtain resources from the computer. The common ones are HTTP, HTTPS, FTP, etc.
Different protocols have different communication content formats; the resource path indicates the specific path to obtain resources from the server

2.2, DNS resolution

DNS: DNS domain name resolution process and principle_snow@li's Blog-CSDN Blog

2.3. Obtain the port number

The default port number of the http protocol is 80.

The IP address is like a street, let you know which street (which host) you are in, the port number is like a house number, tell you which one (which process)

2.4. Establish a TCP connection

Network: TCP protocol three-way handshake and four-way handshake - snow@li's blog - CSDN blog

2.5. Initiate HTTP request

Protocol: mastering the basic content of HTTP_snow@li's Blog-CSDN Blog

2.6. Response to HTTP requests

Protocol: mastering the basic content of HTTP_snow@li's Blog-CSDN Blog

2.7, close the TCP connection

Network: TCP protocol three-way handshake and four-way handshake - snow@li's blog - CSDN blog

2.8. Browser loading, parsing and rendering

Browser loading: Refers to the browser obtaining webpage files and related resources through network requests, and storing them in the cache or loading them on demand, so that users can quickly load data when accessing webpages.
Parsing: Refers to the browser parsing HTML, CSS, and JavaScript into a structure that the browser can understand, and constructing the Document Object Model (DOM) and Style Object Model (CSSOM).
Rendering: Refers to the browser calculating the layout and style of web page elements based on DOM and CSSOM, and drawing them on the screen.

The browser parses the rendering process - Zhihu

Browser loading, parsing and rendering_wk199351's Blog-CSDN Blog

Comprehensive Analysis of Browser Loading, Resolution and Rendering Mechanism - Short Book ,

Browser Rendering: Process and Principle Develop Paper

Browser rendering principle process - Programmer Sought

3. Welcome to exchange and correct me, pay attention to me, and learn together

4. Reference link

What happens after the browser enters the URL and presses Enter? _哔哩哔哩_bilibili

Detailed explanation of the whole process of browser parsing a URL

https://www.cnblogs.com/davina123/p/12978114.html

What happened from entering the URL to the completion of the page loading?

Guess you like

Origin blog.csdn.net/snowball_li/article/details/128411824