Within the user enters a URL to a page showing the contents of this time, the browser and the server what things have taken place in life?

After receiving a user input to the URL, the browser will open a county to process the request, the user inputs URLthe address analysis to determine if it is HTTPthe protocol according to HTTPthe way to deal with.

Method 2 corresponds to invoke the browser engine, such as WebViewthe loadUrlmethod of analysis and load the URLaddress.

3 by DNSanalyzing data acquired the site corresponding to the IPaddress, after the completion of inquiries in conjunction with the browser COOKIE, userAgentand other information to the website purpose IPissued GETrequest.

4 HTTPprotocol session, the browser client to the Webserver to send messages.

5 into the site's back-end Webserver processes the request, such as Apache, Tomcat, Node.jsand other servers.

6 deployed into the back-end applications, such as PHP, Java, Javascript, Pythonand other back-end program, to find the corresponding request processing logic may read the server cache or database queries during this period.

7 server processes the request and sends a response at this time if the browser has visited the page, there is a corresponding cache resources, last modified record will contrast with the server, consistent returns 304, otherwise it returns 200and the corresponding content.

7 browser to start downloading HTMLthe document (header status code response 200time) or read the contents of the file from the local cache (browser cache or effective response header status code 304when).

8 The browser receives the downloaded HTMLfile parsing structure established DOM( Document Object Modeldocument object model) document tree, and in accordance with HTMLthe request to download the tag specifies MIMEthe type of file (e.g. CSS, Javascriptscripts, etc.), and set the contents of the cache and the like.

9 page rendering start parsing DOM, CSSparse and combined according to the rules of DOMthe document tree layout and rendering Web content rendering, Javascriptto provide DOM APIoperation DOM, and read the browser cache, the event binding, etc., the whole page display process is completed.

Guess you like

Origin www.cnblogs.com/baimeishaoxia/p/11874512.html