Making Websites Interactive
Making Websites Interactive
Sends the
Website displayed website’s code to
browser
…Cont’d
- Steps
1. User:- user sends a request to a website. Example: codelab.com
2. Browser:- the browser sends request to a DNS (Domain Name System) server to get IP (internet protocol)
address of the requested website
3. DNS (Domain Name System):- DNS searches for the IP and sends it back to the browser
○ DNS is a server or a computer that stores website names with their respective IP (internet protocol)
address.
○ DNS stores website names and IP addresses in a dictionary format.
○ It’s like the phonebook of the internet
…Cont’d
- Steps
4. Browser: the browser the server/computer that has the IP address for the website code
5. Web Server: the web server send the website code (HTML, CSS, JavaScript) to the browser
○ The web server is any computer that accessible via an IP address.
○ It is where the website code (HTML, CSS, JavaScript) is stored
6. Browser: the browser processes the website code and displays the website to the user
Example: Test your PC and the portfolio project using ngrok (https://ngrok.com/)
CodeLab Academy
Where your innovation journey begins!
- A browser is just a desktop app that enables us to run other desktop apps, i.e., web pages,
dynamically on top of it.
…Cont’d
<html> HTML
<head>
<title>My Page</title>
</head>
Head Body
<body>
<h1>Hello, World!</h1>
</body>
Title h1
</html>
CodeLab Academy
Where your innovation journey begins!
…Cont’d
Example task:
https://software.hixie.ch/utilities/js/live-dom-viewer/
…Cont’d
name: "Negasi",
};
CodeLab Academy
Where your innovation journey begins!
…Cont’d
…Cont’d
const dom = {
nodeName: "HTML",
children: [
{
nodeName: "HEAD",
children: [
{
nodeName: "TITLE",
textContent: "My Page",
children: [],
},
],
},
{
nodeName: "BODY",
children: [
{
nodeName: "H1",
textContent: "Hello, World!",
children: [],
},
],
},
],
};
CodeLab Academy
Where your innovation journey begins!
…Cont’d
2. CSS to CSSOM Tree:The browser parses the CSS code, creating another tree-like structure called the CSSOM (CSS
Object Model).
3. Combine DOM and CSSOM: The browser merges the DOM and CSSOM to create a Rendering Tree
4. Layout Calculation: The browser calculates the exact size and position of each element in the Rendering Tree.
5. Painting: The browser paints the pixels on the screen to display the webpage.
6. JavaScript Execution: If there's JavaScript code, the browser executes it.
○ JavaScript can manipulate the DOM, CSSOM, and other aspects of the page, creating dynamic and interactive
elements.
CodeLab Academy
Where your innovation journey begins!
Resources
1. https://web.dev/articles/howbrowserswork?hl=en
2.