Javascript-when an html page with a css file and a js file is accessed, how many TCP connections will chrome establish? How many htttp requests are initiated?

Source: Internet
Author: User
As shown in. In addition, is the result of ajax data acquisition the same as that of pre-loading a webpage? Is the established TCP connection the same as the http request? Is it very resource-consuming if a handshake is performed every time? Is it true that all elements will be put into the same page at the time of release, as shown in the question.
In addition, is the result of ajax data acquisition the same as that of pre-loading a webpage? Is the established TCP connection the same as the http request?
Is it very resource-consuming if a handshake is performed every time? So it would be better to put all the elements into the same page at the time of release?

Reply content:

As shown in.
In addition, is the result of ajax data acquisition the same as that of pre-loading a webpage? Is the established TCP connection the same as the http request?
Is it very resource-consuming if a handshake is performed every time? So it would be better to put all the elements into the same page at the time of release?

Http requests must be sent to every resource, any resource, or load on the page.

Question 1: ajax and pre-loading have different loading orders for resources, but both generate HTTP requests with the same number of resources. The former can first see the page body and then display the local information, the latter is all loaded and then displayed at one time. The application scenarios are also different.

Question 2: If Connection: keep-alive is set for both the HTTP request header and response header, multiple HTTP requests share one TCP Connection. I casually found an article: Explanation of HTTP header and Keep-Alive mode

Question 3: Reference Question 2

Problem 4: The optimization direction of the front-end includes reducing the number of HTTP requests, so there are Optimization solutions such as CSS sprite and Data URL. However, it also increases the complexity of resource maintenance updates.

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.