- Learn
- Computer Science & IT
- Programming
- Web Development Basics
- How the Web Works
How the Web Works
BeginnerLesson 1 of 8 in Web Development Basics Course
What you will learn
- Explain the roles of clients and servers, and follow the main steps from typing a web address to seeing a finished page, including where each step can go wrong.
- Explain clients, servers and the request–response cycleDescribe what clients and servers are, how a browser asks a server for files, and why one page usually takes many requests.
- Follow the steps from address bar to finished pagePut the main steps in order (reading the address, finding the server, sending the request, receiving the response and building the page) and say what goes wrong at each step.
- Explain clients, servers and the request–response cycle
- Take a web address apart, explain what each part tells the browser and the server, read domain names correctly, and write working links between the files of a site.
- Name the parts of a URLIdentify the scheme, host, port, path, query string and fragment of a web address and explain what each one does.
- Read domain names and explain how they lead to a serverSplit a domain name into its labels, tell who controls a domain, and describe how a name is registered and linked to a server's address.
- Write absolute and relative links between filesChoose between absolute, relative and root-relative addresses, work out where a relative link leads, and name files so links keep working on a server.
- Name the parts of a URL
- Describe what a browser sends to a server and what comes back, and use status codes to tell whether a request worked and, if not, where the problem lies.
- Describe what an HTTP request containsRead the parts of an HTTP request, choose between GET and POST, and explain what the common request headers tell the server.
- Describe what an HTTP response containsRead a response's status line, headers and body, explain media types, and describe how cookies and caching work on top of a stateless protocol.
- Interpret status codes and diagnose failed requestsSort status codes into their five classes, explain the codes you meet most often, and use them to decide whether a problem lies with the request, the server or neither.
- Describe what an HTTP request contains
- Say what each of the three languages of the web does, how they connect in one page, and how the browser turns the files it receives into a page you can see and use.
- Tell apart structure, presentation and behaviorRecognize HTML, CSS and JavaScript code, explain the job of each, and show how a page links them together.
- Explain how the browser builds a page from its filesDescribe how the browser turns HTML into the DOM, applies CSS, runs scripts and draws the page, and explain why view source and the live page can differ.
- Tell apart structure, presentation and behavior
- Prepare a code editor and project folder, preview pages locally, and use the browser's developer tools to inspect elements and styles, read errors and follow every request a page makes.
- Set up a code editor and a project folderInstall and configure a code editor, organize a site's files in a project folder, and preview pages from disk or through a local server.
- Inspect elements, styles and errors with developer toolsOpen the developer tools, inspect and temporarily edit HTML and CSS, read console errors, and preview a page at phone width.
- Follow every request in the Network panelRecord a page load, read each request's status, type, size and headers, and use the panel to find broken links, redirects and caching effects.
- Set up a code editor and a project folder
How the Web Works study guide
1From your browser to a web server
Opening a page starts a conversation between your browser and one or more servers. Follow that conversation from the first address to the files that fill your screen. Seeing the steps separately helps you explain why text can appear before images, why a second visit may load faster, and why a missing file produces a different kind of failure from a server that cannot be reached.
1.1 Clients, servers, and separate resources
A web page on your screen is the result of work in two places. Your browser asks for resources, and a server sends responses. Those roles explain both a simple personal site and a page assembled from several services.
Who asks and who answers
A client is a device and program that requests something. Chrome, Edge, Firefox, and Safari are browser clients. A server is a computer running software that accepts requests and sends back stored files or content it produces. Apache and nginx are examples of web server software. The word "server" can name the computer or that software.
In an HTTP exchange, the client sends a request naming what it wants. The server sends a response to that request. Picture ordering food at a counter: the order slip asks for something, and the tray is the reply. The browser initiates the exchange; an ordinary page response answers a request.
Client and server are roles, not fixed types of machine. A laptop can run both your browser and a test server. A site is hosted when a reachable server makes its resources available. A server reached through localhost runs on your own computer; that address does not take another person's browser to your laptop.
A page is a collection of resources
A resource is something an address can identify: a page, stylesheet, script, image, font, video, or piece of data. The first page request usually retrieves HTML. The browser reads that HTML to discover the other resources it needs and requests each separately.
For example, an article names two stylesheets, one script, and five images. Count the HTML too:
- One HTML resource starts the page.
- Two CSS resources supply its styles.
- One JavaScript resource supplies behavior.
- Five image resources supply pictures.
That makes nine resources and, with an empty browser cache, nine HTTP requests for those resources. A cache stores downloaded copies for reuse. Fresh cached files can reduce the requests that travel over the network on another visit.
The resources need not share a server. The HTML might come from www.example.com, pictures from images.example.net, and a video from another service. Each resource's address tells the browser where to ask. A successful HTML request therefore does not establish that every image or script also loaded.
Stored files and generated replies
| Kind of response | How the server prepares it | Example |
|---|---|---|
| Static | Sends a stored file as it is | An about.html page |
| Dynamic | Runs a program to produce the reply | Search results for a particular query |
In both cases, the browser receives resources it can read or display. A generated HTML page is still HTML when it reaches the browser. The browser holds downloaded copies, while the server keeps the site's original files or the program that produces them.
The web runs over the internet
The internet is the worldwide network that carries data between computers. The web is a service using that network: linked resources addressed by URLs and exchanged through HTTP. Email, online games, and video calls also use the internet. The web is one use of the network, not the name for every activity on it.
Key Takeaways
- An HTTP exchange starts with a client request and receives a server response.
- A page usually needs a separate request for each resource, unless a usable cached copy is available.
- Client and server describe roles; one computer can perform both.
- Static files are stored replies; dynamic replies are produced by server programs.
- The web is a service that runs over the internet.
1.2 The steps in a page load
Pressing Enter on a web address starts several tasks. Each has a different job, so a failure at one stage leaves different evidence from a failure at another.
Read the address and find the server
Take https://www.example.com/news.html. The browser reads https as the scheme, www.example.com as the host, and /news.html as the requested path. Text such as "weather tomorrow" is normally treated as a search and sent to the default search engine instead.
The browser needs an IP address, a numeric network address such as 203.0.113.10 or the IPv6 example 2001:db8::1. DNS, the Domain Name System, finds addresses associated with domain names. The browser and operating system can reuse a recent DNS answer from a cache, so every page visit does not require a new lookup.
Connect and protect the exchange
The browser connects to the server. For HTTPS, it sets up an encrypted connection using TLS. The server presents a certificate that lets the browser check its identity for the requested domain. Encryption protects the messages from being read or changed by others on the network. A secure-connection indicator describes that protection; a scam site can also have a valid certificate.
Data travels across the network in small pieces called packets, through devices called routers, and is put together at the destination. The browser and operating system handle that transport while the browser works with the HTTP messages.
Request, receive, and build
- The browser sends an HTTP request for
/news.html. - The server responds with a status code, headers describing the reply, and usually a body containing the HTML.
- The browser reads the HTML and requests the stylesheets, scripts, images, and other resources it names.
- It builds the page, applies styles, runs scripts, and draws content on screen.
Several resource requests can overlap. The browser can show text before every image finishes downloading; the page is assembled progressively.
For a small page at https://example.org/, suppose the HTML names only style.css and logo.png, both on the same host. With no relevant cached entries, one host needs a DNS lookup and the three resources need three HTTP requests. On a later visit, a cached DNS answer avoids that lookup. Fresh resource copies can be reused, and older copies can be checked with the server. A 304 Not Modified response means a stored copy is still current and the file body need not be sent again.
Locate a failure by its evidence
| Evidence | Stage to investigate |
|---|---|
| Name cannot be resolved | DNS could not find an address |
| Connection times out | The server could not be reached in time |
HTTP 404 response | A server answered, but did not find the requested resource |
| Text appears without its styling | Check the separate stylesheet request |
A DNS failure has no HTTP status code because no HTTP response arrived. A 404 is different: the server answered. Chrome may show a name error such as DNS_PROBE_FINISHED_NXDOMAIN, but the wording is a browser message, not a server response.
Key Takeaways
- The main order is read URL, find address, connect, request, receive, and build.
- DNS maps names to addresses; HTTPS protects the HTTP exchange with TLS.
- The browser can display content while other resources are still loading.
- A DNS or connection failure can occur before any HTTP response exists.
2Read addresses and build working links
A web address tells the browser both where to connect and what to request. Learn to separate its parts, read domain names from the right, and trace links through folders. These skills help you spot a misleading host name and fix a missing image or stylesheet. The same path rules apply when you build a small site locally and when its folder is served from a web server.
2.1 What each part of a URL does
A URL, or Uniform Resource Locator, addresses one resource. The domain name is only one part of that address. The full pattern is scheme://host:port/path?query#fragment, though many addresses leave out optional parts.
Take an address apart
Read this address in pieces:
https://shop.example.com:8443/products/shoes.html?color=blue&size=42#reviews
| Part | Value | Job |
|---|---|---|
| Scheme | https | Chooses encrypted HTTP |
| Host | shop.example.com | Names the server destination |
| Port | 8443 | Selects a service at that destination |
| Path | /products/shoes.html | Identifies the resource to request |
| Query | color=blue&size=42 | Supplies extra input |
| Fragment | reviews | Identifies a location within the page |
The punctuation separates parts: : follows the scheme, ? starts the query, and # starts the fragment. The separators are not part of the query or fragment values.
Scheme, host, and port
The scheme selects how the address is handled. http uses unencrypted HTTP; https uses encrypted HTTP. mailto:info@example.com asks an email program to compose a message, while file:/// addresses a local file.
The port selects a service on the host. If omitted, HTTP uses port 80 and HTTPS uses 443. Thus https://example.com/ and https://example.com:443/ identify the same destination and path. Local test servers often use ports 3000, 5500, or 8080; http://localhost:5500/ includes its port because it is not HTTP's default.
The scheme and host ignore letter case. The host www.example.com is a different name from example.com; both reach a site only when its owner has configured them that way.
Path, query, and fragment
On a simple static site, a path follows the server's folders and files. On other sites, server software decides what a path returns, so a path need not name a file on disk. A folder address ending in / often serves a default page such as index.html.
A query string carries input after ?. In /search?q=web+basics&page=2, & separates two fields: the search words and page number. These fields travel to the server as part of the request target.
A fragment stays in the browser. The suffix #reviews usually scrolls to an element with id="reviews". The browser requests the path and query without the fragment. Changing only #top to #reviews does not ask the server for a different file.
Preserve the exact characters
Web paths use forward slashes /. A space can be percent-encoded as %20. Form encoding uses + for a space and %40 for @; an ordinary URL path or query can contain a literal @, so form encoding and general URL spelling are not identical rules.
Paths may be case-sensitive even though hosts are not. /Images/Logo.png can differ from /images/logo.png. Copying the host correctly but changing a path's capital letters can still request the wrong resource.
Key Takeaways
- A URL separates the destination from the path, query input, and browser fragment.
- Default ports are 80 for HTTP and 443 for HTTPS.
- The query reaches the server; the fragment does not.
- Hosts ignore letter case, but paths may distinguish it.
- Use forward slashes in web paths and encode spaces.
- An address path can be handled by software without matching a stored file.
2.2 Domain names and who controls them
A domain name gives people a readable name to use in place of a numeric IP address. Its dotted parts also show how the name is organized. Reading those parts correctly matters when two addresses contain similar words.
Start at the right end
Each part between dots is a label. In blog.example.org, the rightmost label, org, is the top-level domain, or TLD. The registered domain is example.org, and blog is a subdomain controlled through that domain.
Generic TLDs include .com, .org, .net, .dev, and .shop. Country-code TLDs have two letters, such as .nl, .de, .jp, .br, and .ca. Some have eligibility rules: .gov is restricted to verified US government organizations. New institutional .edu registrations generally require eligible, institutionally accredited US postsecondary institutions; some organizations qualify under other policies, and older registrations can have exceptions. ICANN coordinates the domain name system's top-level names.
A registered name is not always just the final two labels. Under .co.uk, for example, the registered name in news.example.co.uk is example.co.uk. Read the public ending first, then identify the name registered beneath it.
Familiar words can sit inside someone else's name
Compare these hosts:
| Host | Controlling registered domain |
|---|---|
accounts.example.com | example.com |
example.com.signin.example.net | example.net |
In the second host, the words example.com are labels on the left of example.net. They do not give the owner of example.com control of the address. Identify the host before reading it from the right; a familiar name in a path is not the host either.
www is an ordinary subdomain label. A site owner can use it, omit it, or redirect between names. Its presence is not required by the web.
Registration and hosting are separate
A registrar handles domain registrations for customers. A registry maintains the records for a TLD. Registering a domain gives you the right to use that name for a term, usually one or more years. You renew it to retain that right; an expired name can eventually become available to someone else.
The owner then configures DNS records to associate the name with a hosting server's address. The domain is not the website's files. The same name can be pointed to a different server, and one server can serve several domains. Cached DNS answers explain why a changed address can take minutes or hours to be seen everywhere.
Name rules and local names
Ordinary host labels use letters, digits, and hyphens, with no hyphen at either end. Each label can have up to 63 characters, and an ordinary full name can have up to 253 characters. Names ignore letter case. Internationalized domain names support other writing systems; their encoded ASCII labels begin with xn--.
The special name localhost means the computer making the request. Its loopback addresses include 127.0.0.1 and ::1. If a learner opens http://localhost:3000/, the browser looks for a service on that learner's own computer.
Key Takeaways
- Read domain labels from right to left to identify the registered domain and its subdomains.
- A familiar name on the left of a different registered domain does not control that host.
- Registration reserves a name for a renewable term; hosting makes resources available.
- DNS connects names to server addresses, and cached answers can delay visible changes.
localhostaddresses the computer making the request.
2.3 Paths that reach the right file
A link can contain a full address or instructions for finding a resource from the current page. To predict where it goes, start with the page's address and follow the path one part at a time.
Choose the starting point
| Kind of link | Example | Starting point |
|---|---|---|
| Absolute | https://example.com/images/logo.png | The named scheme and host |
| Relative | ../images/logo.png | The current page's folder |
| Root-relative | /images/logo.png | The top of the current site |
An absolute URL identifies its own host and works from any page. It is useful for another website. A relative URL omits the beginning and is completed from the page's address. For files inside a site, this helps the folder move together from a laptop to a server.
Work through a folder tree
Suppose a site contains these files:
my-site/
index.html
about.html
images/logo.png
styles/main.css
blog/first-post.html
From index.html, about.html stays in the same folder. images/logo.png enters the images subfolder, and styles/main.css enters styles.
From blog/first-post.html, the starting folder is blog. To reach the logo, use ../images/logo.png: first go up to the site folder, then enter images. The link images/logo.png would instead look inside blog/images, where this tree has no logo. To reach the home page from that post, use ../index.html.
Trace nested addresses
On https://example.com/blog/2026/post.html:
photo.jpgbecomeshttps://example.com/blog/2026/photo.jpg.../index.htmlbecomeshttps://example.com/blog/index.html./about.htmlbecomeshttps://example.com/about.html.#commentsstays on this document and identifies itscommentselement.
A leading / replaces the current path from the site root. It does not mean "one folder up." Repeating ../ climbs multiple folder levels: ../../about.html from the nested post goes up through 2026 and blog before finding about.html.
Preview links in the right environment
A root-relative path works with an HTTP server, including a local server. On a file:/// page, / points toward the root of the computer's file system, not your project folder. Use a local server when testing this style of link.
A path such as C:\Users\sam\site\logo.png or file:///Users/sam/site/logo.png identifies a location on one computer. Other visitors do not have that folder. Link with a web path that stays inside the site's structure.
Match names exactly
Use lowercase names, hyphens instead of spaces, and correct extensions: contact-form.html is easier to link reliably than Contact Form.HTML. Windows and macOS commonly ignore filename case, while many web servers distinguish it. A local link to Logo.png can fail online when the actual name is logo.png.
A home page named index.html is a common server default. Requesting a folder such as /blog/ usually serves its index.html when that server is configured with this default.
Key Takeaways
- Absolute links supply their own destination; relative links begin in the current page folder.
- Each
../climbs one folder, while a leading/starts at the site root. - Test root-relative links through a web server.
- Paths and filenames must match, including letter case and extensions.
3Read the messages and diagnose failures
Every resource request produces evidence you can inspect: the method and address sent by the browser, the response headers, and the status code. Read these parts together to tell a successful download from a redirect, a reused file, or a failure. You will also see how cookies and caching build useful features on top of separate HTTP exchanges, and why a page's appearance alone cannot tell you what its server returned.
3.1 Inside an HTTP request
HTTP, the Hypertext Transfer Protocol, defines how web clients request resources and how servers reply. HTTPS carries those messages over an encrypted connection. Reading a request shows what the browser asked the server to do.
Read the message in order
Here is a request shown in HTTP/1.1 text form:
GET /products/shoes.html?color=blue HTTP/1.1
Host: shop.example.com
Accept: text/html
Accept-Language: en-US,en;q=0.9
The first line contains the method, the request target, and the HTTP version. GET asks to retrieve a resource. The target includes the path and query; it excludes any fragment. The host appears in the Host header, which lets one server distinguish the sites it serves.
A header is a named field such as Accept: text/html that carries information about the request or its content. An empty line ends the headers. Some requests then carry a body, the data being sent. This GET example has no body.
HTTP/2 and HTTP/3 encode messages differently, but retain methods, targets, headers, and bodies. DevTools presents them in readable form, so these message parts remain useful across versions.
Choose a method for the action
| Method | Intended action |
|---|---|
| GET | Retrieve a resource |
| POST | Submit data for processing |
| HEAD | Retrieve response headers without a body |
| PUT | Replace a resource |
| PATCH | Change part of a resource |
| DELETE | Remove a resource |
Following a normal link or typing an HTTP address makes a GET request. An HTML form uses GET by default and POST when it specifies method="post".
With a GET form, fields go into the URL query. This suits a search whose results you want to bookmark or share. POST places submitted fields in the request body and suits actions such as creating an account or posting a comment.
POST does not encrypt anything by itself. On plain HTTP, both query data and body data can be read in transit. HTTPS protects both. Passwords belong in POST bodies over HTTPS because URLs also appear in browser history and may be stored in logs.
Read a form submission
POST /signup HTTP/1.1
Host: www.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 38
name=Ana+Silva&email=ana%40example.com
The target is /signup. Content-Type identifies the body's form encoding. The body contains the name "Ana Silva" and the email "ana@example.com": + decodes to a space and %40 to @. There are 38 bytes here, matching Content-Length.
Reading, repeating, and identifying requests
A safe method is intended to read without changing server state; GET, HEAD, and OPTIONS are safe. An idempotent method has the same intended effect if repeated. Safe methods, PUT, and DELETE are idempotent. POST is not guaranteed to be: repeating a submission can create a second comment or order.
Other request headers include User-Agent for client information, Accept for acceptable formats, and Accept-Language for language preferences. Cookie returns stored cookie values. Referer, with its historical spelling, can identify the referring page; browsers may omit or reduce it according to policy.
Key Takeaways
- A request names a method and target, then supplies headers and sometimes a body.
- GET retrieves resources; POST submits data for processing.
- HTTPS protects messages in transit; POST alone supplies no encryption.
- A query travels in the request target, while form POST data travels in the body.
- Safe methods are intended to read; idempotent methods have the same intended effect when repeated.
- HTTP versions change the encoding without removing the main message parts.
3.2 Inside an HTTP response
The response is the server's answer to one request. Its code tells you the outcome, its headers describe the reply, and its body carries the returned content when a body is allowed.
Separate the parts
A response in HTTP/1.1 text form can begin like this:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1534
Cache-Control: max-age=600
<!DOCTYPE html>
<html lang="en">
...
The status line gives the version, code 200, and human-readable reason phrase OK. Programs use the number. HTTP/2 and HTTP/3 do not carry that reason phrase. After the headers and an empty line, the body begins with the HTML.
Content-Length describes a byte count, not a character count or a visible page size. For an image response with Content-Length: 24576, the body has 24,576 bytes: 24.576 kB, or about 24.6 kB using 1 kB = 1,000 bytes.
Identify the body by its media type
The media type, also called a MIME type, is sent in Content-Type.
| Media type | Typical content |
|---|---|
text/html | A web page |
text/css | A stylesheet |
text/javascript | A script |
image/png, image/jpeg, image/svg+xml | Images |
application/json | Structured data |
The header tells the browser how to handle the body; a filename extension alone is not enough. If a stylesheet URL returns an HTML error page with Content-Type: text/html, the browser rejects it as CSS. This often explains a page with text but no intended styling.
Bodies can be text or binary bytes. A response to HEAD has no body, even when its headers describe the resource a GET would return. 204 No Content and 304 Not Modified also have no body.
Carry identity between separate requests
HTTP is stateless: an exchange does not automatically remember an earlier one. A cookie supplies information that connects requests to an ongoing session.
- The server responds with
Set-Cookie: session=abc123. - The browser stores the cookie.
- On later matching requests, it sends
Cookie: session=abc123. - The server can use that value to look up the session, such as the learner's login or cart.
Cookie scope and browser rules control which requests receive it.
Reuse content without downloading it again
Cache-Control: max-age=600 lets the browser treat a stored response as fresh for 600 seconds, or 10 minutes. During that period it can reuse the copy without contacting the server. After it becomes stale, the browser can ask whether it changed. A 304 means reuse the cached body; a 200 can deliver a replacement.
If saved CSS changes do not appear, check whether the browser reused a copy. A hard reload, commonly Ctrl+Shift+R on Windows/Linux or Cmd+Shift+R on macOS, or DevTools' Disable cache option helps fetch fresh resources. That checkbox applies while DevTools is open.
Other useful response headers include Location for a redirect destination, Date for the response date, and Server for server software information when supplied.
Key Takeaways
- The status describes the outcome; headers describe the response; the body carries content.
Content-Typeidentifies the body format, andContent-Lengthcounts bytes.- HEAD,
204, and304responses have no body. Set-Cookiestores a cookie; laterCookieheaders return it on matching requests.- A fresh cached response can be reused;
304validates a stored body.
3.3 Status codes as troubleshooting evidence
A status code is the three-digit outcome in an HTTP response. The number describes one request, so one page can have successful HTML, a missing image, and a redirected script at the same time.
Start with the first digit
| Class | Meaning |
|---|---|
| 1xx | Informational, usually an interim message |
| 2xx | Success |
| 3xx | Redirection, including cache validation |
| 4xx | The request cannot be fulfilled as sent |
| 5xx | A server failed to fulfill the request |
200 OK is the usual successful GET. 201 Created reports creation of a new resource, often following POST. 204 No Content reports success without a response body.
Follow a redirect without confusing it with a failure
301 Moved Permanently and 308 Permanent Redirect give a permanent new location. 302 Found and 307 Temporary Redirect give a temporary one. The response's Location header identifies the next address.
For example, a request to http://example.com/ can return 301 with Location: https://example.com/. The browser then sends a new request to the HTTPS address, which returns 200. Those are two exchanges, not a single response with two codes.
307 and 308 preserve the method when the browser repeats the request. After 301 or 302, a browser may change POST to GET. 304 Not Modified is a different kind of 3xx result: it validates a cached copy and sends no replacement body.
Match the code to the useful next check
| Code | Meaning and next step |
|---|---|
400 Bad Request | Check malformed request data or syntax. |
401 Unauthorized | Supply valid authentication, such as logging in. |
403 Forbidden | The server refuses access; check permission. |
404 Not Found | Check the exact requested path and filename. |
405 Method Not Allowed | Check whether the endpoint accepts that method. |
429 Too Many Requests | Slow down or wait before retrying. |
500 Internal Server Error | A general failure occurred inside the server. |
502 Bad Gateway | An intermediary received an invalid upstream response. |
503 Service Unavailable | The service is unavailable, often temporarily. |
504 Gateway Timeout | An intermediary did not receive an upstream response in time. |
A 503 may include Retry-After to indicate when to retry. The difference between 401 and 403 is especially useful: missing or invalid authentication differs from a refusal of permission. A 4xx label identifies the request side to investigate, but a site can still have a broken link or a configuration problem that causes it.
Diagnose the particular resource
Suppose HTML and CSS return 200, while images/Logo.PNG returns 404. The server's actual file is images/logo.png. Correcting the link's case makes it identify the stored file. A server answered the failed request; the entire site was not unreachable.
For a 5xx response, the failure is in server-side handling. A learner viewing someone else's site can retry later or report it. A developer responsible for that server investigates its code or upstream service.
Read the response, not just the screen
An error message inside HTML does not determine the status. A site can return 200 with a "not found" message, called a soft 404. Conversely, a real 404 can include a polished HTML error page. Use the Network panel to read the actual code.
When DNS or the connection fails, no HTTP response may exist at all. A browser-generated error then has no server status to inspect. An isolated 404 for /favicon.ico, the small tab icon browsers may request, often leaves the page content working.
Key Takeaways
- The first digit classifies a response; the full code gives a more specific outcome.
- Redirects name their next location in
Location;307and308preserve the method. 304means reuse a cached body, not download a new page at another address.- Check paths, authentication, permissions, and methods for relevant 4xx responses.
- 5xx responses identify a failure in server-side handling.
- An error page can have a body and status that tell different stories.
- No HTTP response means there is no HTTP status code.
4How HTML, CSS, and JavaScript become a page
The files a browser receives have different jobs. HTML gives content meaning, CSS controls its appearance, and JavaScript adds behavior. Follow how the browser combines them into a live page, and why a page can look correct while a button fails. Short code examples show what to recognize in each language and how script timing connects a loaded file to the elements it needs.
4.1 Structure, style, and behavior in separate files
A page combines content, presentation, and behavior. Recognizing these jobs helps you choose which file to inspect when you want to change something.
HTML describes what the content is
HTML, HyperText Markup Language, gives content structure and meaning: headings, paragraphs, lists, links, images, tables, and forms. It is a markup language. It describes elements instead of performing calculations or running loops.
In <a href="about.html">About us</a>, the opening tag is <a href="about.html">. The href attribute gives the destination. "About us" is the content, and </a> closes the element. Attributes belong inside the opening tag.
Some elements are void and have no content or closing tag. For example, <img src="logo.png" alt="Company logo"> supplies an image address and a text alternative. <br>, <link>, and <meta> are other void elements.
Choose elements for meaning. Use a heading because the text introduces a section; use CSS when you want larger text or extra spacing. Several <br> elements are a poor substitute for spacing rules.
CSS controls how content looks
CSS, Cascading Style Sheets, sets color, type, spacing, layout, and adaptation to different screen widths. Read this rule:
h1 {
color: navy;
font-size: 2rem;
}
The selector, h1, identifies the elements to style. Each declaration pairs a property with a value. color: navy; sets the color property to navy. The colon separates property and value; the semicolon ends the declaration.
JavaScript responds to actions
JavaScript is a programming language. It responds to clicks and typing, changes the live page, checks form input, and requests more data without a full page reload. It is a different language from Java.
For a theme button, a script can find the button, listen for clicks, and switch a CSS class:
document.querySelector("button").addEventListener("click", () => {
document.body.classList.toggle("dark");
});
The script changes whether the body has the class dark; CSS supplies that class's appearance. A static information page can work with HTML and CSS alone.
Connect the files in HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My first page</title>
<link rel="stylesheet" href="styles/main.css">
<script src="scripts/app.js" defer></script>
</head>
<body>
<h1>Hello, web</h1>
<p>This text is structured by HTML and styled by CSS.</p>
<button>Switch theme</button>
</body>
</html>
The <head> holds page information and file links. The <body> contains the displayed content. The browser requests styles/main.css and scripts/app.js separately from the HTML. All three are plain-text files you can open in a code editor.
Separation of concerns keeps content in HTML, appearance in CSS, and behavior in JavaScript. One stylesheet can style many pages. A meaningful heading and an ordinary link still work if styling or scripting fails, while features that depend on JavaScript need their script to work.
Key Takeaways
- HTML gives content structure and meaning; attributes add information to opening tags.
- CSS selectors choose elements, and declarations set property values.
- JavaScript adds behavior and can change the live page.
- HTML links external CSS and JavaScript files, each loaded as a separate resource.
- Separate content, presentation, and behavior to make changes easier to manage.
4.2 The live page inside the browser
The browser does not display HTML as a picture of a text file. It turns the file into objects, works out their styles and positions, and draws the result. JavaScript can then change those objects.
Build a tree from HTML
The DOM, or Document Object Model, is the browser's live tree of elements and text. Consider:
<body><h1>News</h1><p>Hi <a href="/">home</a></p></body>
The body has two element children, h1 and p. The heading contains "News". The paragraph contains the text "Hi " and an a element, which contains "home". The link is inside the paragraph, not directly inside the body.
While reading HTML, the browser discovers resources in elements such as <link>, <script>, and <img>. It requests those resources and reads the CSS to calculate each element's final styles. Layout calculates sizes and positions. Paint draws the pixels. These tasks can happen again when content or styles change.
Let scripts run when their elements exist
A classic external script without defer or async pauses HTML parsing while it downloads and runs. If it is in the head and tries to find a button later in the body, that button has not been built yet. document.querySelector("button") returns null, so calling addEventListener on the result produces an error.
| Script loading | When a classic external script runs |
|---|---|
Plain <script src="app.js"> | At its place in the document, pausing HTML parsing |
With defer | After HTML parsing, preserving document order |
With async | As soon as it is ready, without guaranteed order |
Add defer to let a script download while HTML parsing continues and run once that parsing is complete. Moving a plain script just before </body> also lets earlier elements exist first. async does not guarantee that a later button exists; its download may finish early.
Source HTML and the live DOM can differ
View Page Source shows the delivered HTML. The Elements panel, called Inspector in Firefox, shows the live DOM. JavaScript may have added content, changed text, or removed elements. The browser may also have repaired malformed HTML, for example by closing an element.
If a heading changes after a click, the Elements panel shows the changed text. View source still shows the HTML originally received. A DOM change can trigger updated styles, layout, and paint without fetching a new HTML document.
Different errors have different effects
Browsers repair HTML using defined rules and skip CSS declarations they do not understand. A JavaScript syntax error, such as an unfinished expression, prevents that script file or block from starting. An uncaught runtime error ends the current execution, skipping later lines in that run. Other scripts and already registered event handlers can still work. This explains a page whose content and style remain visible while one feature fails.
Browser engines implement common standards: Blink in Chrome and Edge, Gecko in Firefox, and WebKit in Safari. Small implementation differences make testing in more than one browser useful. Browsers also build an accessibility tree from the page's structure so screen readers can present meaningful elements and relationships.
Key Takeaways
- The DOM is the live tree of elements and text built from HTML.
- The browser calculates styles, performs layout, and paints pixels.
- For classic external scripts,
deferwaits for HTML parsing;asyncdoes not guarantee that order. - View source shows delivered HTML; Elements shows the current DOM.
- A syntax error stops a script from starting; an uncaught runtime error ends the current run.
- Meaningful HTML also supports the accessibility tree.
5Set up a project and inspect what happens
A small project folder and your browser's developer tools give you a practical way to learn. Save a page, preview it through a local server, and use the browser to inspect its live elements and requests. The panels answer different questions: what is on the page, which style wins, what code failed, and which resource arrived. Work through a complete edit-and-check loop so each change leaves evidence you can verify.
5.1 An editor, a project folder, and a preview
A web project starts as files in a folder. A code editor helps you write those files, and a browser lets you preview what they produce. Keeping the editor and browser pointed at the same copy of the project prevents many confusing results.
Choose a plain-text code editor
A code editor saves plain-text files and adds syntax highlighting, completion, error hints, a file tree, and other coding aids. Word processors store document formatting and may replace straight quotes with curly quotes, so they are unsuitable for source code.
Visual Studio Code is a free option for Windows, macOS, and Linux. Other editors include Sublime Text, Zed, and WebStorm. An online playground such as CodePen suits short experiments; the file and path skills carry over between tools.
Create and open a project
For a first VS Code project:
- Download and install the editor from its official website,
https://code.visualstudio.com/. - Create a folder such as
web-projects/my-first-site. - Choose File → Open Folder and open
my-first-siteso the file tree shows the whole project. - Create
index.html. In HTML mode, type!and choose the Emmet suggestion for an HTML skeleton. - Save with Ctrl+S on Windows/Linux or Cmd+S on macOS.
Use a folder structure that matches the roles of your files:
my-first-site/
index.html
styles/main.css
scripts/app.js
images/logo.png
Use lowercase names and hyphens, with no spaces. Keep the extensions visible so index.html does not silently become index.html.txt. Save text as UTF-8 and include <meta charset="utf-8"> in the HTML head so text such as accented names is interpreted correctly.
Choose a preview method
| Preview | Address starts with | Suitable use |
|---|---|---|
| Open the file directly | file:/// | Simple HTML and CSS checks |
| Run a local web server | http://localhost:.../ | Testing web paths and features served through HTTP |
A local web server serves a folder on your own computer. It might use http://localhost:5500/ or http://127.0.0.1:3000/; use the address your preview tool supplies. Root-relative paths need a server to start at your site's root. Features such as JavaScript modules or fetching data also need HTTP preview because browsers restrict their use on local-file pages.
In VS Code, Microsoft's Live Preview extension or a Live Server extension can start a server and refresh the preview after saving. Check the publisher before installing extensions because extensions run code on your computer. Format on save, word wrap, and Auto Save can make editing easier; a formatter such as Prettier keeps formatting consistent.
Follow the edit-and-check loop
Edit, save, reload or let the preview reload, inspect the result, and fix the file. If the browser still shows old content, check the editor's unsaved indicator and compare the preview's path with the project you opened. You may have two folders with the same page name. Also check the exact filename and extension; a text-file suffix can stop the browser from treating a file as an HTML page.
Key Takeaways
- Use a code editor that saves plain-text files, and open the complete project folder.
- Keep clear folders, exact extensions, lowercase filenames, and UTF-8 text.
- A local HTTP server supports site-root paths and features restricted on
file:pages. - The working loop is edit, save, reload, inspect, and fix.
5.2 Inspect elements, styles, and errors
Browser developer tools expose the page you are actually running. Use them to test a style, read an error, or compare the live page with the file in your editor.
Open the tools and choose a panel
Right-click part of a desktop page and choose Inspect. Common shortcuts are F12 or Ctrl+Shift+I on Windows/Linux and Cmd+Option+I on macOS. Safari first needs its developer features enabled in Settings → Advanced; the option's wording varies with the Safari version.
| Panel | What it shows |
|---|---|
| Elements, or Inspector in Firefox | Live DOM and selected element's styles |
| Console | JavaScript messages, errors, and an input prompt |
| Sources, or Debugger in Firefox | Loaded source files and script debugging |
| Network | Requests and their responses |
Find a style that wins
Inspect a heading. Selecting its node highlights its box on the page, including content, padding, border, and margin. The Styles pane lists rules and their source locations, such as main.css:12. A crossed-out declaration is not taking effect there: another rule may override it, or the declaration may be invalid. Invalid declarations can also carry a warning indicator.
Open Computed to see the final values. If two rules specify different text colors, the computed color tells you the result. You can temporarily change a value, disable a declaration, or edit text and attributes to test an idea.
Ordinary live edits affect your tab's DOM or styles. Reloading replaces them with the loaded files. To keep an improvement, make the same edit in the source file, save, and reload. Changing a displayed price in Elements changes the local display; it does not change the server's stored price.
Read a console error as a clue
An error includes a message and usually a file and line. For example:
Uncaught TypeError: Cannot read properties of null
(reading 'addEventListener') at app.js:3
Read app.js:3 as the source location to inspect. The code tried to use a missing object. If a selector searched for a button, check that its spelling matches an element and that the element existed when the script ran. The message alone does not choose between those causes.
The Console also shows failed resource loads, such as a GET ending in 404, and messages printed by console.log(). A script error can explain a nonworking button even when its file downloaded successfully.
Try a small expression and a narrow screen
The Console can evaluate JavaScript. Typing 2 + 3 returns 5; document.title returns the current title. The assignment document.body.style.background = "lightyellow" changes the page's background in the tab. Do not paste code from someone you do not trust into the Console; it runs with access to the page and can misuse an account.
Use the phone-and-tablet icon for responsive mode. Choose a narrow width such as 375 CSS pixels to see how the layout fits. This simulates a viewport, not every behavior of a real phone; a real-device check adds information that resizing cannot provide.
Key Takeaways
- Elements shows the live DOM; Styles and Computed help explain the final appearance.
- Ordinary live edits must be copied into source files to survive a reload.
- Use console messages and source locations to investigate failed code.
- A missing-element error can come from a wrong selector or early script execution.
- Responsive mode checks viewport sizes, while real devices can behave differently.
5.3 Trace a load in the Network panel
The Network panel shows the separate exchanges behind a page. It can reveal why one image is missing, why styling failed, or why a reload transferred less data than expected.
Record before reloading
Open DevTools, choose Network, make sure recording is active, and reload the page. The panel cannot reconstruct requests that finished before it was opened. If the list is empty, check recording and filters, then reload again.
Rows show each request's name or URL, method, status, type, size, and time. The waterfall shows when requests started and how their timings overlap. It helps you see a page load as several resource fetches instead of one indivisible action.
Open a row for the full evidence
Select a request. Headers shows the requested URL and method, response status, and request and response headers. Preview displays a useful view of supported response content. Response shows the returned content more directly, while Timing breaks down the time spent in phases of the request.
For a missing image, compare the full requested address with the image's actual location. A filename alone can hide a wrong parent folder.
Diagnose an example load
| Name | Method | Status | Content-Type | Transferred |
|---|---|---|---|---|
index.html | GET | 200 | text/html | 8.2 kB |
main.css | GET | 200 | text/css | 3.1 kB |
app.js | GET | 200 | text/javascript | 1.4 kB |
Hero.jpg | GET | 404 | text/html | 0.6 kB |
logo.png | GET | 200 | image/png | 18.5 kB |
Five requests transferred 31.8 kB in total. The Hero.jpg request failed. Its small HTML body is the server's error page, which explains the text/html media type on an image request. If the actual file is images/hero.jpg, change src="images/Hero.jpg" to src="images/hero.jpg" and reload to test the fix.
Filter on Img to focus on pictures, CSS for stylesheets, or a name to find a particular resource. When a stylesheet fails, inspect both its status and Content-Type. Even a 200 cannot make an HTML response into usable CSS.
Keep redirects and cached responses visible
Turn on Preserve log, called Persist Logs in Firefox, before following navigation that you want to trace. An HTTP-to-HTTPS redirect can then show a 301 row and its Location header followed by a new 200 request.
A row marked "(memory cache)" or "(disk cache)" means the browser reused stored content. A 304 still involved a server response, but only headers came back, saving a repeated body transfer. The Size and Transferred columns therefore answer different questions from the file's size alone.
Use Disable cache while DevTools is open to compare with fresh fetches. Throttling simulates a slower connection so you can watch which content appears first. Labels for speed presets vary by browser release.
A failed row without a response status can be a DNS or connection failure; Chrome may show net::ERR_NAME_NOT_RESOLVED. Outside the browser, curl -I https://example.com sends HEAD and prints the status and headers for a quick response check.
Key Takeaways
- Open Network and start recording before reloading the page.
- Inspect the full URL, status, media type, and response together.
- Use filters for missing resources and Preserve log for navigation or redirects.
- Cached bodies and
304responses reduce transferred data in different ways. - Throttling shows behavior on a slower connection.
- No response status can indicate a failure before HTTP received an answer.
How the Web Works examples
1Follow a page from request to screen
12 steps
- 1IntroductionWatch a page being assembled
A page can show its heading while a picture is still loading. To explain that, follow a browser opening
https://example.net/trails.html. We will separate the browser’s request, the server’s reply, and the extra resources named in the HTML. Then use the same sequence to locate a failure. - 2ExplanationIdentify who asks and who answers
The browser is the client: it initiates the request for a resource. The server runs software that answers with a stored file or generated content. These are roles. A laptop can run both your browser and a local test server.
For this visit, the browser asks for
/trails.html, and the server returns a response whose body contains HTML. - 3AnalogyTreat a request like an order
Think of the client as a customer placing an order at a counter. The request identifies what the customer wants, and the response is what comes back.
For an ordinary HTTP resource fetch, the browser starts the exchange. The server does not need to know what the page looks like on your screen; it supplies the requested content for the browser to interpret.
- 4ExampleCount the document before its pictures
Suppose the returned HTML names one stylesheet, one script, and two images. Start by counting the HTML itself: that is one resource. Add the stylesheet and script to reach three, then the two images to reach five.
With an empty resource cache, fetching these files takes five resource requests. The page looks like one object on screen, but its parts travel separately.
- 5ChallengePredict a partly working page
The HTML, script, and stylesheet arrive, but one of the two image requests fails. Must the whole page disappear? Explain.
---reveal---
No. The browser can display the resources it received while the failed image remains missing. Each resource has a separate exchange. Success for the HTML does not guarantee success for the picture, and failure for the picture does not erase the HTML.
- 6ExplanationFind the host before requesting the path
For
https://example.net/trails.html, the browser identifies the hostexample.netand path/trails.html. DNS supplies an IP address for that host unless a recent answer is already cached.The browser then connects to that destination. A name lookup provides the address; it does not download the HTML or any of its linked images.
- 7Key InsightProtect the connection
Because the scheme is
https, the browser establishes TLS protection before the ordinary HTTP exchange. The server’s certificate supports checking its identity for the domain.This protects messages against reading or alteration on the network. A valid certificate and a secure connection do not establish that a site’s business or claims are honest.
- 8ExampleBuild as the files arrive
The browser sends its request and receives the HTML response. Reading the HTML reveals the CSS, script, and image addresses. The browser requests those resources and can overlap their downloads.
It builds the document, applies styles, runs scripts, and draws the page. Text can appear first, with the images filling in later. It does not wait for every file before beginning all display work.
- 9ChallengeDistinguish no address from no file
One visit fails with a name-resolution error and no response status. Another returns
404for/trails.html. Did both failures reach the same stage?---reveal---
No. The first failed to obtain the host’s address, before an HTTP response arrived. The second reached a server that answered but did not find the resource. A browser error page can appear in both cases, so inspect the network evidence.
- 10ConnectionReuse earlier work on another visit
On a later visit, the browser may already know the host’s address and hold fresh copies of some files. DNS caching avoids another name lookup; resource caching avoids some repeated downloads.
If a stored resource needs validation, the server can answer
304 Not Modified. That exchange still occurs, but it carries no new resource body because the saved one is usable. - 11ChallengeLocate the failure in the full sequence
A page’s HTML returns
200, but its CSS request returns404. The page shows plain text. Which step failed, and what should you check?---reveal---
The initial page request succeeded; a later resource request failed. Check the stylesheet’s resolved URL against its actual location and filename. Repeating DNS setup is not the useful first check because the server already answered the CSS request.
- 12RecapUse the sequence to choose a check
Read the load as a sequence: identify the host, find its address, connect, request, receive, and build. Remember that the HTML usually triggers more requests.
When something fails, first locate the failed stage. Then check the specific host, path, response, or browser action involved.
2Read a URL and trace its links
14 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionGive each address part a job
- 2ExampleSplit the destination from the resource
- 3ExplanationSeparate input from a page location
- 4ChallengeChange only the fragment
- 5ExplanationRead a host from the right
- 6ExampleInspect a look-alike host
- 7ChallengeExplain what registration supplies
- 8ExplanationChoose the link’s starting point
- 9ExampleClimb out of a nested folder
- 10ExampleTry another valid starting point
- 11ChallengeFind a neighboring page
- 12TipKeep the path spelling exact
- 13ChallengeCombine the host and path checks
- 14RecapRead before you follow
3Read an exchange and choose the next check
16 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionUse the messages as evidence
- 2ExampleRead the first line and host
- 3ExplanationMatch a method to the action
- 4ExampleRead a small submitted body
- 5ChallengePredict a repeated submission
- 6ExplanationSeparate status, headers, and body
- 7ExampleConnect separate requests with a cookie
- 8ExampleUse a fresh copy first
- 9ExampleValidate after freshness expires
- 10ChallengeExplain a small transfer
- 11ExplanationUse the class to narrow the problem
- 12ExampleDistinguish identity, permission, and path
- 13ExampleFollow a new location
- 14ChallengeRead the error family precisely
- 15ChallengeRead the reply behind the name
- 16RecapCombine the message parts
4Turn source files into a live page
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionFollow a button from markup to behavior
- 2ExampleGive the content a meaning
- 3ExampleAdd a presentation rule
- 4ExplanationReact to the click
- 5ChallengeChoose the file for the change
- 6ExplanationBuild the live tree
- 7ExampleRun too early and find nothing
- 8ExampleWait for the parsed document
- 9Key InsightCompare source with the live result
- 10ChallengeExplain a visible page with a failed button
- 11ChallengeCombine arrival, timing, and the live DOM
- 12RecapConnect each stage to its result
5Set up, preview, inspect, and fix a page
15 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake one change you can verify
- 2ExplanationOpen a project in a code editor
- 3ExamplePreview through HTTP
- 4ChallengeFind why an edit seems missing
- 5ExampleInspect the element you want to change
- 6ExampleTest a style, then save it
- 7ChallengeChoose evidence for a silent button
- 8TipCheck a narrow viewport
- 9ExplanationRecord the next load from its start
- 10ExampleRead a failed picture’s full URL
- 11ExampleVerify the result of the source fix
- 12Key InsightSeparate reuse from a new body transfer
- 13ChallengeInterpret a redirect and its destination
- 14ChallengeCombine the editor and browser checks
- 15RecapClose the loop in the saved source
How the Web Works practice questions
Set 1: Follow addresses and resource requests10 Practice Questions
Question 1 of 10
Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
https://learn.example.org:9443/notes.html?unit=4#tasks, what is the request path?Show answerHide answer
/notes.html, the part identifying the resource after the host and optional port. The query begins at ?, and the fragment begins at #, so neither belongs to the path. The HTTP request target can include the query, which is a larger part than the path alone.Question 4 of 10
https://billing.example.com.check.example.net/pay. Which registered domain controls this host?Show answerHide answer
.net is the public ending, and example.net is the registered domain. The labels check, com, example, and billing sit beneath it. The familiar example.com at the left does not make this a host controlled through that registered domain.Question 5 of 10
https://example.org/ into https://example.org/course/, keeping its folder structure. On course/lessons/start.html, ../images/map.png works but /images/map.png fails; the map is at course/images/map.png. What explains the difference?Show answerHide answer
/course/lessons/, so ../ climbs to /course/ before entering images/. A leading slash discards the current path and requests /images/map.png at the host root. Moving the folder tree kept the relative relationship but changed its location below the site root.Question 6 of 10
Show answerHide answer
Question 7 of 10
200. Its diagram request returns 404. What does that evidence establish?Show answerHide answer
404 is an HTTP response saying the requested resource was not found. The successful HTML exchange and the failed diagram exchange are separate, so the page can still display without that diagram. A server that could not be reached would not have supplied the 404 response.Question 8 of 10
Show answerHide answer
Question 9 of 10
index.html has an image at /images/compass.png that fails. The project contains that file under its images folder. What preview change lets the leading slash refer to the site root?Show answerHide answer
/images/compass.png is resolved from that root. A direct file: preview interprets a leading slash from the file system’s root instead of the project folder. The image’s existence inside the project does not change that starting point.Question 10 of 10
Show answerHide answer
Set 2: Read messages and follow broken resources10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
hours.html file on each request, but runs a program to build a catalog search reply. How are the two responses classified?Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
https://example.net/find?q=trees#results. What target does an ordinary HTTP/1.1 request use?Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
https://example.com/help/setup/linux.html. The stylesheet is at https://example.com/assets/theme.css. What relative path reaches it?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Content-Type: application/json. What does this header describe?Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
401 before sign-in. After valid sign-in, it responds 403. What changed?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
/join; a 302 redirects to /register. The browser next sends GET there and receives 405. /register accepts POST with the original body, and the move is temporary. What redirect change preserves the intended submission?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
home.html.txt. What filename correction makes it an HTML source file?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
https://example.org/journal/entry.html, a link requests styles/site.css. Network shows 200, Content-Type: text/html, and an HTML fallback page. The real CSS is at /styles/site.css. What source correction and check address the failure?Show answerHide answer
Save this lesson to see this answer.
Set 3: Connect page behavior with network evidence10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
https://help.example.com/topic and https://example.com.help.example.org/topic. Both have valid HTTPS certificates. What comparison identifies their controlling domains and the meaning of the certificates?Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
https://example.net/reference/start.html uses ../about.html. What address does the browser resolve?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
304. A changed stylesheet returns 200 with a 5 kB body. An uncached HTML page returns a 9 kB body. Excluding headers, how much body data crosses the network?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
200 and throws an error when calling addEventListener on null. Its selector exactly matches a button later in the body, and the final DOM contains that button. What edit addresses the timing shown?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
projects/atlas/index.html, but the preview address points to projects/atlas-copy/index.html. Reloading still shows the old heading. What should you align first?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Diagnose a complete local page10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
www.example.org, but its photos are addressed at photos.example.net. Where does the browser request the photos?Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
www.example.com return 200. A logo URL uses cdn.example.net, and its row shows net::ERR_NAME_NOT_RESOLVED with no status. What part of the load failed, and why can the text still appear?Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
# and is handled locally by the browser?Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
/comments. A 307 redirects to /store, which accepts only POST, creates one comment per submission, and returns 201. The user repeats the original submission once; the browser follows the redirect again. What methods reach /store, and how many comments are created?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Set-Cookie: session=xyz. The browser stores it, and the next request matches the cookie’s scope. Which request header lets the server connect that request to the stored session?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
200. How should this result be described?Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
<h1> just to enlarge an ordinary note. What change gives the note an appropriate role while keeping control of its size?Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
helpers.js defines a function, and page.js uses it and a button later in the body. Both are currently async, and failures vary with download speed. Which loading change makes both dependencies available in order?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
color: green crossed out and an active color: maroon; Computed reports maroon. You change the active value to teal in DevTools, but it returns to maroon on reload. What do both observations show, and how do you keep teal?Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
Absolute URL
https://example.net/help.html reaches that host whether clicked from a home page or a nested post.Attribute
href for a link destination or src for an image source.<a href="team.html">Team</a>, the href attribute tells the browser where the link goes.Authentication
401 response can mean that the request needs valid authentication before the server will fulfill it.B
Body
C
Cache
Certificate
Client
Code editor
Computed styles
Console
app.js:8 directs you to the script line involved in the failed operation.Content-Length
Content-Length: 24576 describes 24,576 bytes, or about 24.6 kB of content.Cookie
Set-Cookie; the browser later sends it back in Cookie.CSS
D
Declaration
color: teal;, that specifies one presentation setting inside a rule.p { color: navy; margin: 1rem; }, two declarations set paragraph color and margin.Deferred script
defer that runs after HTML parsing, preserving document order among such scripts.Developer tools
DNS
DOM
Domain name
docs.example.com is easier to remember than the numeric address DNS may return for it.F
Forbidden response
403, meaning the server understood the request but refuses to provide the requested access.403 when it has no permission to open a protected resource.Fragment
# that the browser handles locally, often by moving to an element with a matching ID.#contact can scroll the fetched document without sending contact to the server.Fresh response
max-age=600 can remain fresh for 10 minutes before it needs another freshness decision.G
Gateway timeout
504 response indicating that an intermediary server did not receive an upstream server’s response in time.504 while waiting for the application server that should have produced the page.H
Header
Name: value.Accept: text/html says that the client can handle an HTML response.Host
https://learn.example.net/intro, the host is learn.example.net and the path is /intro.HTML
HTTP method
HTTPS
I
Idempotent method
Internet
IP address
203.0.113.10 can represent a server destination in a page-loading diagram.J
JavaScript
L
Label
help.example.org has three labels, read from the general ending toward the specific name.Layout
Local web server
http://localhost:5500/ handles a site-root path as a web path instead of a disk-root path.Loopback address
127.0.0.1 in IPv4 or ::1 in IPv6.127.0.0.1 connects your browser to a service running on your own computer.M
Media type
text/css for CSS or application/json for data.text/html, inspect whether the server supplied an error page instead.N
Network filter
P
Paint
Parent directory
../ moves to one parent level while resolving a relative web path./notes/week/page.html, ../index.html reaches /notes/index.html after one move upward.Parsing
Path
/images/map.png tells the server which resource the browser wants after connecting.Port
8080 in http://localhost:8080/ selects the port used by that particular local test server.Preserve log
Project folder
index.html, styles/, and images/ together makes it easier to check whether a link matches a file.Q
Query string
?, commonly arranged as name=value pairs separated by & and sent with the request target./search?q=css&page=3, the query supplies both the search term and the requested results page.R
Redirect
Location header with a redirect status.301 from an HTTP address can send the browser to request the HTTPS address in a second exchange.Registrar
Registry
Relative URL
/guide/start.html, the link images/icon.png reaches the images folder inside /guide/.Request target
/guide?mode=short#tips produces the target /guide?mode=short in an ordinary request.Resource
Responsive mode
Root-relative path
/ and identifies a location from the current site’s root instead of the current page’s folder.example.org, /images/logo.svg starts at that host’s top-level path.Runtime error
null can stop a script from setting up its button even though the script downloaded successfully.S
Safe method
Scheme
https for encrypted HTTP or file for a local file.http://localhost:8080/ tells the browser to use HTTP for the local preview request.Selector
h2 in h2 { color: teal; } matches second-level heading elements on the page.Server
Soft 404
200 differs from a response whose actual status is 404.Stateless protocol
Status code
200 for its HTML and 404 for one picture because the resources have separate requests.Subdomain
example.com can arrange a service at support.example.com without registering a new domain.T
Throttling
TLS
Top-level domain
.com, .org, or the country-code .nl.news.example.org, the TLD is .org; news is a more specific label under the registered name.Transferred size
304 transfers headers without the image body, so its recorded transfer is much smaller than that image.U
URL
https://example.org/help.html#hours, the whole address is the URL; example.org is just its host.UTF-8
V
Viewport
Void element
img, meta, or link.<img src="map.png" alt="Trail map"> describes an image without a matching closing tag.W
Waterfall
Web
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.