Describe how web pages are located, retrieved and displayed on a device when a user enters a URL

Resources | Subject Notes | Computer Science

The Internet and its Uses - Web Page Retrieval

How Web Pages are Located, Retrieved, and Displayed

When a user enters a URL (Uniform Resource Locator) into a web browser, a series of steps occur to locate, retrieve, and display the corresponding web page on their device. This process involves several key components and protocols working together.

1. URL Structure and Components

A URL provides the address of a resource on the internet. It typically consists of several parts:

  • Protocol: Specifies how the browser should communicate with the server (e.g., http:// or https://).
  • Domain Name: A human-readable name for a server (e.g., www.example.com).
  • Path: Specifies the location of the resource on the server (e.g., /index.html).
  • Query Parameters (optional): Additional information passed to the server (e.g., ?search=keyword).
  • Fragment Identifier (optional): Points to a specific section within the resource (e.g., #section1).

2. DNS (Domain Name System) Lookup

The domain name in the URL needs to be translated into an IP address (Internet Protocol address). This is done by the DNS server.

  1. The browser sends a request to a DNS server.
  2. The DNS server checks its cache for the IP address associated with the domain name.
  3. If the IP address is not in the cache, the DNS server queries other DNS servers recursively until it finds the IP address.
  4. The DNS server returns the IP address to the browser.

3. Establishing a Connection

Once the browser has the IP address of the web server, it establishes a connection with the server using the specified protocol (e.g., HTTP or HTTPS). This involves:

  1. The browser sends a TCP (Transmission Control Protocol) request to the server on the IP address and port number (typically port 80 for HTTP or 443 for HTTPS).
  2. A TCP handshake occurs to establish a reliable connection.

4. Sending the HTTP Request

The browser sends an HTTP request to the web server. This request includes information such as:

  • The requested resource (e.g., /index.html).
  • The browser's user agent.
  • Accepted content types.

5. Server Processing and Response

The web server receives the HTTP request and processes it. This may involve:

  1. Locating the requested resource on the server's file system.
  2. Executing server-side scripts (e.g., PHP, Python) if the resource is dynamic.
  3. Generating an HTTP response containing the requested resource (e.g., HTML, CSS, JavaScript, images).

6. Receiving the HTTP Response

The web server sends an HTTP response back to the browser. This response includes:

  • A status code indicating the success or failure of the request (e.g., 200 OK, 404 Not Found).
  • Headers providing information about the response (e.g., content type, content length).
  • The actual content of the requested resource (e.g., the HTML code of the web page).

7. Rendering the Web Page

The browser receives the HTTP response and renders the web page. This involves:

  1. The browser parses the HTML code.
  2. The browser requests additional resources referenced in the HTML (e.g., CSS stylesheets, JavaScript files, images).
  3. The browser downloads these resources.
  4. The browser applies the CSS styles to the HTML elements.
  5. The browser executes the JavaScript code.
  6. The browser displays the rendered web page to the user.
Step Description
User enters URL The user types or clicks on a link to enter a web address in the browser's address bar.
DNS Lookup The browser queries a DNS server to find the IP address associated with the domain name.
Connection Establishment The browser establishes a TCP connection with the web server at the IP address.
HTTP Request The browser sends an HTTP request to the server for the requested resource.
Server Processing The web server processes the request and prepares a response.
HTTP Response The server sends an HTTP response back to the browser with the requested content.
Rendering The browser parses the HTML, downloads other resources, applies styles, and executes JavaScript to display the web page.