Email - harun.bspt2014@gmail.com Phone - +8801717615827

What happens when you navigate to an URL

This is a classical question in an interview. We can concatenate the topics all above in this theme:

  1. Do the DNS query first, it will offer the most suitable IP address with the intelligent DNS parsing.
  2. The following is the TCP handshake. The application layer will deliver the data to the transport layer where the TCP protocols will point out the ports of both ends, and then transport the data to the network layer. The IP protocols in the network layer will determine the IP address and how to navigate to the router, and then the packet will be packaged to data frames. And at last is the physical transport.
  3. After the TCP handshake is the TLS handshake, and then is the formal data transport.
  4. It is possible for the data to go through the load balancing servers before its accesses to the server. The load balancing server will deliver the requests to the application servers and response with an HTML file.
  5. After getting the response, the browser will check the status code, it will continue parsing the file with the status code 200. As for 400 or 500, it will throw an error. If there is 300 code, it will redirect to a new URL. And there is also a redirection counter to avoiding too much redirection by throwing an error.
  6. The browser will parse the file, do decompression if the file type is with compressions like gzip and then parse the file by the encoding type.
  7. After the successful parsing, the render flow will start formally. It will construct the DOM tree by HTML and construct the CSSOM with CSS. If there is a script tag, browser will check it whether has the async or defer attributes, the former will download and execute the JS file in parallel, and the latter will load the file first then wait to execute until the HTML has been parsed. If none of them, it will block the render engine until the JS file has been executed. HTTP/2 may highly improve the download efficiency for pictures.
  8. The DOMContentLoaded event will be triggered after the initial HTML has been loaded and parsed completely.
  9. The Render tree will be constructed following the CSSOM and the DOM tree, in which the layout of page elements, styles and so on will be calculated.
  10. In the process of constructing the Render tree, the browser will call the GPU to paint, composite the layers and display the contents on the screen.

For much more detailed explanation – (https://github.com/alex/what-happens-when/blob/master/README.rst)[https://github.com/alex/what-happens-when/blob/master/README.rst]

Dr. Harun
Dr. Harun

Dr. Md. Harun Ar Rashid, MPH, MD, PhD, is a highly respected medical specialist celebrated for his exceptional clinical expertise and unwavering commitment to patient care. With advanced qualifications including MPH, MD, and PhD, he integrates cutting-edge research with a compassionate approach to medicine, ensuring that every patient receives personalized and effective treatment. His extensive training and hands-on experience enable him to diagnose complex conditions accurately and develop innovative treatment strategies tailored to individual needs. In addition to his clinical practice, Dr. Harun Ar Rashid is dedicated to medical education and research, writing and inventory creative thinking, innovative idea, critical care managementing make in his community to outreach, often participating in initiatives that promote health awareness and advance medical knowledge. His career is a testament to the high standards represented by his credentials, and he continues to contribute significantly to his field, driving improvements in both patient outcomes and healthcare practices.

Translate »
Register New Account