How does the web work?
Follow a page request from your browser to a server and back again.
When you open a website, it can feel as if the page is simply sitting inside your phone or laptop. In reality, your browser and another computer are exchanging messages. The browser asks for a resource; a server responds; then the browser assembles the response into a page.
A visit begins with an address
You enter a URL, such as a website's home page. The browser separates the address into useful parts: the domain identifies the site, while the rest of the URL can identify a particular page or resource. Before it can contact the site, the browser needs to find the network address for that domain.
The browser finds and contacts a server
A system called DNS helps translate a human-readable domain name into an IP address computers can use. The browser then connects to the server at that address. For a secure website, HTTPS protects the connection so other people on the network cannot casually read or alter the exchange.
The browser sends an HTTP request describing what it wants. A simplified request might look like this:
GET /articles HTTP/1.1
Host: example.com
Accept: text/htmlThe server processes that request and sends back an HTTP response. The response includes a status code—such as 200 for a successful request—and may contain HTML, data, images, or other files. A real page commonly needs several requests, not just one.
The browser turns the response into a page
The browser reads the returned HTML to understand the page's structure, CSS to determine how it should be presented, and JavaScript when the page needs interactive behavior. It may also request fonts, images, and data. The browser combines these pieces and gives you the result you can read and interact with.
What to remember
- A browser is a client: it requests resources on a learner's behalf.
- A server receives requests and sends responses, often using HTTP over a secure HTTPS connection.
- DNS helps a browser find the server associated with a domain name.
- The browser assembles returned resources into the page you experience.
This request-and-response model is the foundation for understanding web development. Once it makes sense, APIs become easier to place: they are another way for software to request and exchange information over a network.
Keep following what you understand. This article is part of a growing knowledge library; related topics can help you explore the ideas around it.