What happened in the process of "go" from the input URL to the page load complete?

Source: Internet
Author: User
Tags browser cache

Summary of the issue

One.

Enter the URL to the browser to give you a page, you use everyday things, learn the computer network know is how to, on the DNS and then the page feedback, but to speak good or difficult.

Before the FEX team Nwind specifically wrote the blog about this issue:

http://fex.baidu.com/blog/2014/05/what-happen/

The great thing is that the whole computer system and hardware are involved, very broad and deep, too powerful.

Then find an answer to the StackOverflow:

What happens if you type in a URL in browser

Original link

Http://stackoverflow.com/questions/2092527/what-happens-when-you-type-in-a-url-in-browser

Piskvor's Answer:

Make a simple rough description, assuming it is a simple HTTP request, IPV4, no proxy.

1. Browser query cache, if the cache exists skip to step 9th.

2. The browser asks for the IP address of the operating system server.

3. The operating system does DNS query, return the IP address to the browser.

4. The browser opens a TCP connection to the server (which is more complex if it is an HTTPS protocol).

5. The browser sends an HTTP request over a TCP connection.

6. The browser receives the HTTP response and may turn off the TCP connection, or re-use the connection to process the new request.

7. The browser checks whether the HTTP response is a redirect (3xx result status code), a validation request (401), error (4xx 5xx), and so on, which are normal processing (2XX) for different responses.

8. If the response is cacheable, it will be cached.

9. The browser decodes the response (for example, if it is gzziped compressed).

10. The browser decides how to handle these responses (for example, it is an HTML page, a picture, a piece of music).

11. The browser displays the response, and the download dialog box pops up for the unknown type.

Each step in the side can be lengthy and, of course, there are a lot of things that happen in parallel with these steps.

Finish

Two

See an interesting question from the microblog:

what happened in the process of loading from the input URL to the page?

This question immediately reminds me of my several high school teachers. Almost every time, my senior high school teachers will emphasize the importance of the subject, in our lives, how profound and complex impact. Similarly, in the field of programmers, people will feel that part of their work is more important, a little more to the enterprise, each department will feel that they are an important part of the company. In this issue, from the URL input to the page loading completed, by different people, it became a completely different story. You will see who sees the trees, who sees the forest, who is acting as God, and who is swimming naked. It is more a psychological problem than a technical one. Gossip, and see my answer.

After the user enters the URL in the browser, there are at least 2 participants, one is a browser and the other 1 is a remote server.

Browser

The browser requests a page on behalf of the user to the server (which is why the browser is called the user agent), and the server returns a page to the browser.

A Web page usually has many components. Include direct exposure to the part, such as:

    • Text.
    • Image.
    • Video.

And the parts that are not visible to the user:

    • CSS file.
    • JavaScript files.

Regardless of whether it is visible, the browser cannot get all of these page components (resources) at once, it must be requested from the server one at a time and wait for the return. These resources are not necessarily on 1 servers, they may be distributed across multiple servers.

The resources that the browser takes in hand are not well-assembled, as the human eye sees. These are just messy raw materials, the browser must organize them well, so that users see the design of the Web page designers look like: navigation bar, tags, pictures, tables, submit buttons, links, text color, size and so on. The process of composition can also be referred to as "rendering" in general.

Browser using CSS files, do the following matters: paragraph Z of the text with red halo, font enlargement, underline; picture X on the left side of the paragraph p, 1/4 of the space, the right side left 2% of the gap; Use JavaScript files to do some dynamic effects (such as prompting you for input, etc.), or to add/ Delete something, and a variety of real-time interactions with the server.

Server

Let's look at one end of the server. It seems to be responsive. If you ask him for a resource, he will return you. If not, he will tell you No.

The server may have many classifications, a server that can run a service (such as a dedicated image service), or a server that can run multiple services (such as providing both picture and video services), or multiple servers that provide a service (such as several servers that form a picture server cluster).

How the browser interacts with the server depends to a large extent on:

1-The complexity of the page itself. If the page is very simple, it may only require 1 requests. If the page is very complex, you may need to make an X-request to n servers.

2-server-side deployment scenarios. If it is a small web site, it is possible that only 1 servers provide all services. In the case of a very large web site, there may be N servers offering a class of services.

Between the two

The browser and server relationship looks simple, one says "Give me" and the other says "give". Just as you unscrew the pipe and expect the water to flow out of the pipe, it seems that as long as the browser openings, the server will continuously output resources.

To communicate with any two objects, make sure they are in the same language, or "protocol." URL This string carries the protocol information, such as HTTP, HTTPS, FTP and so on.

What the different protocols mean, I think it should be further explained by the books of Stevens and so on. The next point is that the browser and server must communicate according to the protocol, and you will have to conform to the specification.

However, before the two chapters, there is another important factor is how the browser can find the target server?

This is what the "Domain Name System" plays an important role. Like a phone address book, a name (username) corresponds to a number string (XXX-XXXX-XXXX), and in the domain Name System, a domain name corresponds to an IP address. Browsers and dnsserver you ask me (also to communicate by a protocol) that you can get the IP of the target server and then communicate through "protocol".

In the computer network, there seems to be an unlimited number of intermediaries between two points without interfering with the communication between the two. Just like a drum spread flowers, a station to pass down, will always reach the end, or return to the starting point. Here is a small example.

We can extend this graph infinitely, and then we need different experts on each node, and these experts will make a variety of emphasis on the "URL input to page loading complete" analysis. From the browser's core, to the composition of the operating system, to the analysis of the protocol stack, to all kinds of servers, different colors of the cloud (cloud computing), in short, is brilliant. However, you can think of them as waiters and cooks who offer you a big meal in the restaurant. They are very interesting and enthusiastic, but you should take a pat on the butt after dinner.-)

Finish

Three

Feel good to answer, quote from http://segmentfault.com/q/1010000000489803 own memo
      1. Enter Address
      2. The browser finds the address of the domain name IP
        This step includes a DNS specific lookup process, including: Browser cache, system cache, router cache ...
      3. The browser web sends a request to the server HTTP
      4. Permanent redirect response of the server (from http://example.com to http://www.example.com )
      5. Browser Tracing REDIRECT Address
      6. Server processing Requests
      7. The server returns a HTTP response
      8. Browser displayHTML
      9. The browser sends a request to get embedded HTML resources (slices, audio, video, CSS and JS so on)
      10. The browser sends an asynchronous request

What happened in the process of "go" from the input URL to the page load complete?

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.