Rapid-Fire Web & Networking.
A frontend engineer lives at the boundary of the browser and the network. Interviewers test that boundary with quick definitions — URL vs URI, the HTTP verbs, how the browser stores things, what stops a request cross-origin. Here's the rapid-fire round, each answer kept to the point.
What this guide covers
- Addresses & HTTP — URL vs URI, methods, status codes, redirects
- Storage & state — cookies, localStorage, sessionStorage, caching
- Security & origins — CORS, the same-origin policy, CSRF vs XSS
- The wire — HTTP versions, TCP vs UDP, WebSockets vs SSE, DNS
- Loading & the browser — async vs defer, reflow vs repaint, resource hints
Naming things, and asking for them
The opening question is almost always a definition. Nail the precise wording — interviewers listen for whether you actually know the spec or are guessing.
https://site.com/page. A URN (Name) identifies by name without location: urn:isbn:0451450523. Every URL is a URI; not every URI is a URL. In everyday speech people say "URL" but mean URI.GET retrieves data — params go in the URL, it's idempotent, safe, and cacheable, with no body by convention. POST submits data in a body, is neither safe nor idempotent (it creates/changes state), and isn't cached by default. Never put sensitive data in a GET URL — it lands in logs, history, and referrers.PUT replaces a resource entirely and is idempotent (same request twice = same result). PATCH applies a partial update. POST creates a new resource or triggers a non-idempotent action. "Idempotent" is the word they want: PUT/DELETE/GET are, POST is not.301 is permanent — browsers and search engines cache it and pass SEO "link juice" to the new URL. 302 (and the clearer 307) is temporary — don't cache, keep using the original. Use 301 for a moved page, 302 for a temporary A/B or maintenance redirect.Where the browser keeps things
"Where would you store a token?" is a trap that bundles three concepts — persistence, scope, and security. Know the table cold.
HttpOnly, Secure, SameSite. localStorage (~5–10MB) persists until cleared and is never auto-sent. sessionStorage is the same but cleared when the tab closes and scoped per-tab. Both Web Storage APIs are synchronous and string-only.HttpOnly, Secure, SameSite cookie is the safest mainstream answer. localStorage is convenient but readable by any injected script — one XSS and the token leaks. The honest interview answer names the XSS-vs-CSRF trade-off rather than declaring one option universally "correct".Cache-Control do?max-age=N sets freshness seconds; no-cache means revalidate before use (not "don't cache"); no-store means never store; immutable means never revalidate; stale-while-revalidate serves stale instantly while refreshing in the background. Hash your static asset filenames so you can use a long max-age safely.What the browser won't let you do
Origins and the attacks against them are where interviewers separate juniors from people who've shipped to production.
fetch another site's authenticated data and read it freely.Access-Control-Allow-Origin. For "non-simple" requests the browser first sends a OPTIONS preflight asking permission. Key point: CORS is enforced by the browser and configured on the server — the frontend can't fix a CORS error alone.SameSite cookies. XSS steals/runs code; CSRF rides an existing session.Protocols under the request
You don't need to implement TCP, but you should be able to say what each layer buys you and when to reach for a persistent connection.
.com) → authoritative server for the domain, which returns the IP. The result is cached per its TTL. It's the first network step before any TCP connection opens.Getting the page painted, fast
The last cluster is about how the browser turns bytes into pixels — and the small attributes that move performance numbers.
async vs defer on a script?async executes as soon as it arrives — order not guaranteed, may interrupt parsing. defer waits until parsing finishes and executes in document order, right before DOMContentLoaded. Use defer for app code that depends on the DOM or other scripts; async for independent things like analytics.transform/opacity can skip both via GPU compositing. Avoid layout thrashing by batching DOM reads before writes.preload fetches a resource needed for the current page at high priority (fonts, the LCP image). prefetch fetches something likely needed on the next navigation at low priority. preconnect warms up the DNS+TCP+TLS handshake to a third-party origin so the eventual request is faster.<head> stall it — which is why we inline critical CSS and defer scripts.The bottom line
"The web rapid-fire round rewards precision over volume. Know the exact definitions — a URL is a URI that locates, PUT is idempotent and POST isn't, an origin is scheme+host+port — and know which side enforces each rule: the browser enforces same-origin and CORS, the server configures them; the browser enforces caching that Cache-Control declares. Most follow-ups are just 'and why?' — so always pair the definition with the reason it exists."
Five you should be ready to follow up on
- Walk a request end to end. "What happens when you type a URL and hit enter?" stitches DNS, TCP/TLS, HTTP, and the critical rendering path into one story.
- Debug a CORS error. Be ready to say it's fixed on the server with
Access-Control-Allow-Origin, and to explain the preflightOPTIONS. - Defend against XSS and CSRF. Name CSP + output escaping for XSS, and tokens +
SameSitefor CSRF. - Justify a token storage choice. Frame it as the XSS (localStorage) vs CSRF (cookies) trade-off, then land on HttpOnly cookies + in-memory access token.
- Explain why HTTP/2 helped. Multiplexing removed the need for hacks like domain sharding and sprite sheets that HTTP/1.1 forced on us.
Before you leave — how confident are you with this?
Your honest rating shapes when you'll see this again. No grades, no shame.
Comments
Loading comments…