Browser
✅ Main components of the broswer
browser follows HTML and CSS rules based on W3C
world wide web consortium
Each tab runs in a seperate process(multiple instances of rendering engine)
1. User Interface
where user interacts with the browser
- address bar
- next buttons
- home button
- refresh
- all parts except the window where requested web page is displayed
2. Browser Engine
bridge between user interface and rendering engine
3. Rendering Engine
render the requested web page on the browser screen
interprete HTML, XML documents and images
interpete CSS, generate the layout that is displayed on UI
- Different browser different rendering engine
- Chrome: Blink
- Chrome iphone & Safari: Webkit
4. Networking
retrieves the URLs using HTTP or FTP
handle internet communication, security
- use cache of documents to reduce network traffic
5. Javascript Interpreter
interprete, execute JS
interpreted results are sent to rendering engine for display
6. UI Backend
draw widgets
not platform specific
7. Data persistence/storage
persistence layer
small database created on the local drive of the computer where browser is installed
store data such as cookies, cache, bookmarks, preferenes
💡 DOM
Document Object Model
how web browser interpretes HTML
💡 Parsing
interprete document so that browser can understand code
✅ Summary of how browser works
- Enter URL, hit enter, request is sent to server
Rendering engine
parse
through HTML, constructDOM tree
- Then
parse
CSS, making style - With HTML, CSS, construct
render tree
. This render tree will create page with resources and style Layout
of the render treePainting
the rendering tree with UI backend painting.- Rendering Engine display content on the screen as soon as possible for better user experience. Painting and Layout does not wait for HTML parsing to be complete. Display content while rest of content still keeps coming from the network.
💡 Reference
https://medium.com/@yaduvanshineelam09/how-does-web-browsers-work-ec0f171aedc6