DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How To Create a Network Graph Using JavaScript
  • Mutual TLS With gRPC Between Python and Go Services
  • AWS Web Application and DDoS Resiliency
  • Improving ui-select Control

Trending

  • Testing SingleStore's MCP Server
  • It’s Not About Control — It’s About Collaboration Between Architecture and Security
  • Debugging Core Dump Files on Linux - A Detailed Guide
  • SQL Server Index Optimization Strategies: Best Practices with Ola Hallengren’s Scripts
  1. DZone
  2. Coding
  3. Languages
  4. Browser Life Cycle

Browser Life Cycle

Learn what happens when a URL is typed into the browser, from the different types of caches, to the HTTP request and response flow, to render trees.

By 
Venkatraman Ramamoorthy user avatar
Venkatraman Ramamoorthy
·
May. 16, 18 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
13.0K Views

Join the DZone community and get the full member experience.

Join For Free

Every time a URL (Uniform Resource Locator) is typed in the browser’s address bar, we are fascinated by the web page's appearance. Mainly web developers are intended to know what exactly is happening inside to get you that nice attractive web page.

Address bar.

Let’s imagine that you want to access the Stack Overflow website and type “https://stackoverflow.com/" in the address bar, which is part of the browser’s User Interface, which will talk to the network layer.

User Interface (address bar) to Network Layer.

The Network layer checks the cache for a DNS record to find the corresponding IP address of the domain “StackOverflow.com.”

What Is Cache?

Cache is a collection of data duplicating original values stored elsewhere on a computer, usually for easier access.

When we say cache here, we mean web cache.

What Is Web Cache?

A web cache (or HTTP cache) is an information technology for the temporary storage (caching) of web documents, such as HTML pages and images, to reduce server lag. For example, ETag or CDN.

Four-Level Cache

There will be four levels of cache available to help check for DNS records to find the domain IP address.

What Is DNS?

The Domain Name System (DNS) is a hierarchical decentralized naming system for computers, services, or other resources connected to the internet or a private network.

Let's have a look at the below diagram of browser requests and check for the four levels of caches.:

  1. Browser Cache—Check for the DNS cache where the browser maintains its own cache of DNS.
  2. OS Cache—When the browser cache is not available, the browser would make a system call for the DNS cache information maintained by the operating system.
  3. Router Cache — When the browser and OS cache are not available, it will look for a router cache.
  4. ISP Cache — When all three of the above caches are not available, the ISP’s DNS server initiates a DNS query to find the IP address of the server that hosts StackOverflow.com.

Assume that the network layer worked closely with the DNS Record Search to find the IP Address using the corresponding domain (StackOverflow.com).

We found the IP address from the DNS Record to proceed further. Our next step is sending the request and receiving the response.

HTTP Request & Response

The browser's Network Layer manages HTTP requests and responses. The below diagram helps to understand how HTTP requests and responses are being sent and received.

  1. The browser sends a TCP Connection with the Stack Overflow Server through the IP Address.

  2. The TCP Connection is established for data transmission.

  3. The browser sends an HTTP Request to the Web Server.

  4. The StackOverflow Server sends out an HTTP Response to the browser.

Shush, Be Quiet. It's Not Over.

We just got the HTTP Response. Now you see the below network information where you can see the IP Address (151.101.65.69), which helps to make the HTTP Request.

Stack Overflow IP Address with HTTPS PORT (:443).

Response content types are HTML, CSS, and JavaScript. The lifecycle of sending a request and receiving the response is always the same for all the various responses, but every response we get has a different content type.

Below is the series of various responses; imagine the phase through which we got the response from the network layer and is yet to get passed to the browser engine for processing.

HTML Response Header

Below is the Response Header of every web page, which is actually HTML of the content type “text/HTML.”

Browser Response Header for HTML.

Image Response Header

Below is the Response Header of a PNG Image with the content type “image/png.” There are different images available, like JPEG, which is “image/jpg,” GIF, which is “image/gif,” and SVG, which is “image/svg+xml.”

Response Header of HTML.

JavaScript Response Header

Below is the Response Header of a JavaScript file with the content type “text/javascript.”

Response Header of JavaScript.

CSS Response Header

Below is the Response Header of a Stylesheet File with the content type “text/css.”

Response Header of CSS.

Rendering Engine

The Browser User agent receives the response and passes it to the Rendering Engine, which is also called a Layout Engine.

What Is a Rendering Engine?

A rendering engine is software that draws text and images on the screen. The engine draws structured text from a document (often HTML) and formats it properly based on the given style declarations (often given in CSS). Examples of layout engines are Blink, Gecko, Edge, and WebKit.

Critical Rendering Path.

Let’s take an example response of HTML content, which is the text document in nature.

The rendering engine parses the markup document, creates the Well Formed document, and constructs the object called DOM; for CSS files, its creates CSSOM.

The CSSOM and DOM trees are combined into a Tree is known as the “Render Tree.”

Render Tree of DOM and CSSOM — Image Credit: https://developers.google.com.

The render tree has DOM and CSSOM nodes, which are needed to render the web page. Layout finds the accurate position and size of each object to draw the web page according to the Viewport of the device, called the “Layout” stage also known as “Reflow.”

Render Tree Formation.

Painting (Stage Show)

This is the final act, known as Painting/Rasterizing, where the visible nodes from the Render Tree are converted to actual pixels on the browser screen.

The output of the layout process is called a Box Model where it adds padding, borders, and margins.

Handling JavaScript

There is one exceptional response; It is our superhero JavaScript who can do things dynamically, no matter if its HTML, CSS, or both. This guy nicely handles our browser’s scripting language.

When there is a JavaScript content type of response, it will be communicated to the scripting engine of the browser (which is an Interpreter, and also JIT Compiler who does things in runtime). It will execute the JavaScript code, and through JavaScript, you can access DOM and CSSOM APIs to make it interactive.

It will throw a series of errors if there are any errors found in that particular JavaScript file.

Cool, isn't it? Happy browsing!

Domain Name System Cache (computing) Web Service JavaScript Engine HTML Stack overflow Requests Network IT

Opinions expressed by DZone contributors are their own.

Related

  • How To Create a Network Graph Using JavaScript
  • Mutual TLS With gRPC Between Python and Go Services
  • AWS Web Application and DDoS Resiliency
  • Improving ui-select Control

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!