What happens to a page from the input URL to the page load display completed

Source: Internet
Author: User

Front-end interview/written test questions, the more detailed the better

It's easy to say:

Browser According to the requested URL to DNS domain name resolution, find the real IP, to the server to initiate the request;

Server to the background processing after the completion of the return data, the browser receives files (HTML, JS, CSS, images, etc.);

The browser parses the loaded resources (HTML, JS, CSS, etc.) and establishes the corresponding internal data structures (such as the DOM of HTML);

Load parse to the resource file, render the page, complete.

To say in detail:

1, when sending a URL request, whether the URL is a Web page URL or the URL of each resource on the Web page, the browser will open a thread to handle the request, the URL analysis to determine if the HTTP protocol is handled by the web;

2, call the browser kernel corresponding methods, such as WebView in the Loadurl method;

3. Start a DNS query on the remote DNS server, which enables the browser to obtain the corresponding IP address of the request. The IP address of the URL is obtained through DNS resolution, and the second GET request is made by setting up the UA and other information;

4, the HTTP protocol session, the client sends the header (Request header): The browser and the remote Web server through the TCP three handshake negotiation to establish a TCP/IP connection. The handshake consists of a synchronization message, a synchronous-response message, and a response message, which is passed between the browser and the server in three messages. The handshake is first attempted by the client to establish communication, then the server answers and accepts the client's request, and finally the client sends a message that the request has been accepted.

5, into the Web server WebServer, such as Apache, Tomcat, node. js and other servers;

6, into the deployed back-end applications, such as PHP,Java,JavaScript,Python , etc., to find the corresponding request processing;

7, processing the end of the feedback header, here if the browser has access to, the cache has a corresponding resource, and the server last modified time comparison, the same will return 304;

8, the browser begins to download the HTML document (response header, status Code 200), while using the cache;

9, the document tree establishment, according to the tag request to specify the MIME type of files (such as CSS, JS), and set up a cookie;

10, the browser will parse the HTML generated DOM tree, followed by the creation of Cssrule tree according to CSS, and JavaScript can operate the DOM according to Domapi, perform event binding, etc., the page display is complete.

What happens to a page from the input URL to the page load display completed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.