The article gives a simplified picture of what happens when you see a web page in a web browser on your computer or smartphone. This theory is not essential for writing the web code in the short term, but in the long run, you will start to benefit from understanding what is happening in the background.
Web-connected computers are called clients and servers.
– Customers are the typical Internet-connected devices of web users (for example, your computer connected to Wi-Fi, or your phone connected to the mobile network) and the web page access software available on those devices (usually a web browser), like Firefox or Chrome).
– Servers are computers that store web pages, websites, or applications. When a client device wants to access a webpage, a copy of the webpage is downloaded from the server on the client’s machine to be displayed in the user’s web browser.
The client and server I described above do not tell the whole story. There are many other parties involved, which I will describe below.
For now, let’s imagine that the web is a road. At the end of the road is the client, who is like your home. At the other end of the road is the server, which is a store where you want to buy something.
In addition to the client and server, we must also remember:
– Your internet connection: which allows you to send and receive data on the web. It’s basically like the street between your house and the store.
– TCP/IP: Transmission Control Protocol/Internet Protocol are communication protocols that define how data should flow across the web. This is like the transport mechanisms that allow you to place an order, go to the store and buy your goods. In my example, this is like a car or a bike (or any other way you can get closer).
– DNS: Domain name servers are like an address book for websites. When you enter a web address in your browser, it looks at the DNS to find the actual website address before you can retrieve the site. The browser needs to find out which server the website is on so that it can send HTTP messages to the right place (see below). It’s like looking for the address of the store so you can access it.
– HTTP: Hypertext Transfer Protocol is an application protocol that defines a language for clients and servers to talk to each other. It’s like the language you use to order goods.
– Component files: A website is made up of several different files, which are like different parts of the goods you buy from the store. These files are of two main types:
2. Resources: This is a collective name for all the other things that make up a website, such as images, music, video, Word documents, and PDF files.
When you enter a web address in your browser (for my analogy, this is like going to the store):
– The browser goes to the DNS server and finds the real address of the server on which the website is located (see the store address).
– The browser sends an HTTP request message to the server, asking them to send a copy of the site to the customer (you go to the store and order the goods). This message and all other data sent between the client and the server are sent over your internet connection using TCP / IP.
– Provided the server approves the client’s request, the server sends the client a “200 OK” message, which means “Of course you can look at that site! Here it is! ”, And then starts sending the website files to the browser, like a series of small pieces called packets of data (the store offers you the goods, and you bring them back to your home).
– The browser assembles the small pieces into a complete site and displays it (the goods arrive at your door – shiny new things, fantastic!).