When you enter www.baidu.com to page rendering in the browser address bar:
1. Domain name resolution (DNS resolution) (Network layer)
the IP address of the domain name is first found in the cache , and no more requests are sent to the domain name server.
-browser's DNS Cache (for example, view the DNS cache in the Chrome browser, enter chrome://net-internals/in the Address bar #dns view the DNS cache within the browser. )
- -The DNS cache for the operating system (the window System brings up the cmd window, enter command Ipconfig/displaydns at the Windows to view the DNS cache within the system.)
--Operating system hosts file (C:\Windows\System32\drivers\etc\hosts)
-- The operating system sends requests to the LDNS ( local domain name server ) (80% success rate )
Iterative DNS Domain name resolution ( domain name is graded from right to left ) without finding
- LDNS initiates a request to the root name server. com top address of the domain name server
- LDNS initiates a request to the (. com) domain's top-level domain name server, requesting the address of the . baidu.com domain Name server
- LDNS initiates a request to the top-level domain Server (. baidu.com) domain, requesting the IP corresponding to the www.baidu.com domain name
- LDNS the resulting IP address back to the host operating system, the operating system cache the domain name and the corresponding IP cache, the operating system and then the IP is returned to the browser, and the browser is cached.
2. Establishing a TCP link (Transport Layer)
To send a request to the server through an HTTP or HTTPS protocol, a browser must first establish a link to the server. The client establishes a link to the IP corresponding server based on the TCP protocol. (Three-time handshake mechanism)
3. The browser sends an HTTP request to generate an HTML page (application layer)
The following is the approximate rendering process, the specific resource file loading order Next Chapter
- HTML code into DOM (Dom Tree)
- CSS code converted to Cssom (CSS Object Model)
- Combine DOM and Cssom to create a rendering tree (with visual information for each node) (Render trees)
- Build layout to plane synthesize all nodes of all render trees
- Draw the layout (paint) on the screen
4. Client disconnects from server
the client disconnects from the server by waving four times ( four-time wave mechanism )
The above is just a simple narrative process, not to explain the details of each step of knowledge and principles, we can check their own books.
Ten years of grinding a sword, frost Blade never tried. Today, who has an injustice?
What happened to the browser from the input URL to the page rendering?