How Browsers Work?
Ever wondered how these web browsers like Google Chrome, Firefox or Internet Explorer work? How they deliver the web pages of a site when we hit the address? And how it works internally? Well, it involves a lot of things, let me explain in simple ways.
So, When we open a browser and hit an address, let's say www.google.com, through the Internet the browser tries to reach the IP address of a server by translating the domain name and then the server delivers all the required resources for the website.
A website is a collection of web pages, documents and multi-media files that are hosted on a server on the Internet. A web page is an HTML document, which in association with stylesheets(CSS) and scripts(JS) renders the contents of a website. So in short, a website is a bundle of HTML, CSS, and JS files.
HTML: An HTML(Hypertext Markup Language) document describes the layout, format and content of a page. The Web browser renders the page according to the HTML structure.
CSS: A CSS(Cascading Style Sheet) defines the look of a website, the styling part.
JS: And finally JS(Javascript) gives a multitude of functionalities to the website, the functionality part.
Okay, so these components contribute to the Front-End part. But, what's the inside story? How the browser works with all these files?
So here are different components of a Browser:
So, When we open a browser and hit an address, let's say www.google.com, through the Internet the browser tries to reach the IP address of a server by translating the domain name and then the server delivers all the required resources for the website.
A website is a collection of web pages, documents and multi-media files that are hosted on a server on the Internet. A web page is an HTML document, which in association with stylesheets(CSS) and scripts(JS) renders the contents of a website. So in short, a website is a bundle of HTML, CSS, and JS files.
HTML: An HTML(Hypertext Markup Language) document describes the layout, format and content of a page. The Web browser renders the page according to the HTML structure.
CSS: A CSS(Cascading Style Sheet) defines the look of a website, the styling part.
JS: And finally JS(Javascript) gives a multitude of functionalities to the website, the functionality part.
Okay, so these components contribute to the Front-End part. But, what's the inside story? How the browser works with all these files?
So here are different components of a Browser:
- Networking:
This part is responsible for all the request and response handling through which a browser fetches different files and content or data. It involves various implementations for different platform.
- The rendering engine:
- The user interface:
- The browser engine:
- UI backend:
- JavaScript interpreter:
- Data storage:
Okay, so now you got to know about different components. Let's see how they interact in simple words.
When a web page and associated contents are fetched from a server to the browser, the browser checks for the HTML templates first. It parses the code and creates a structure(DOM- Document Object Model). Then comes rendering of elements and creates a render tree. Element by element it traverses all the component and defines the layout, width, height, alignment etc. Then it stylizes the elements through css.
[ Note: If you have worked on jQuery or plain javascript, then you must be aware of document.ready and window.onload. Do you know which is called first? The answer is document.ready. because the DOM is loaded first then comes the content. And after all the content are properly loaded then window.onload is called. ]
So, This is how a browser works!! :D
We have tried to explain in simple words. Let's know if you have any queries or feedback.
Happy Exploring!!
So, This is how a browser works!! :D
We have tried to explain in simple words. Let's know if you have any queries or feedback.
Happy Exploring!!
Comments
Post a Comment