Below are the step-by-step descriptions of how
page get displayed in your browser when you simply enter some URL in address
bar:
- You type an URL into address bar in your preferred browser.
- The browser Parser the URL to find the Protocol, host, port and path.
- Its forms a HTTP request.
- To reach the host, it first needs to translate the human readable host into an IP number and it does this by doing a DNS lookup on the host.
- Then a Socket needs to be opened from the user’s computer to that IP number on the port specified (most often port 80).
- When a connection is open, the HTTP request is sent to the host.
- The host forwards the request to the Server software (most often Apache) configured to listen on the specified port.
- The server inspects the request (most often only the path) and launches the Server plug-in needed to handle the request (corresponding to the server language you use PHP, Java, .Net, Python).
- The plug-in gets access to the full request and starts to prepare a HTTP response.
- To construct the response database is (most likely) accessed. A database search is made, based on Parameters in the path (or data) of the request.
- Data from the database, together with other information the plug-in decides to add, is combined into a long string of text (probably HTML).
- The Plug-in combines that data with some Meta data (in the form of HTTP headers) and sends the HTTP response back to the browser.
- The browser receives the response and Parse the HTML (which with 95% probability is broken) in the response.
- A DOM tree is built out of the broken HTML.
- New requests are made to the server for each new resource that is found in the HTML source (typically images, style sheets and Java files). Go back to step 3 and repeat for each resource.
- Style sheets are parsed and the rendering information in each gets attached to the matching node in the Dom tree.
- Java Script is parsed and executed and DOM nodes are moved and style information is updated accordingly.
- The browser renders the page on the screen according to the Dom tree and the style information for each node.
- You see the page on the screen.
And we get annoyed why the response time is
very high but now at least I have some documentation to look at, while waiting
the remaining fractions of a second before the page renders.
good explantion
ReplyDelete