Browser Interview Questions
12 Browser interview questions with worked answers, complexity notes, and runnable code you can edit in the browser — ordered easy to hard so you build up steadily. Free, no signup. Open any question for the full answer.
Why the platform underneath matters
Frameworks abstract the browser, but interviews for senior roles peel that abstraction back. The question behind most of these is: what actually happens between typing a URL and seeing pixels? A request resolves DNS, opens a connection, and streams HTML; the parser builds the DOM, CSS builds the CSSOM, the two combine into a render tree, and layout → paint → composite turn that tree into what you see. Every performance question you will ever get is a variation on “which step did you block, and for how long?”
Two distinctions separate people who memorized a framework from people who understand the runtime. First, reflow versus repaint: changing geometry forces the browser to recompute layout, while changing color only repaints — and knowing which properties trigger which is how you keep animations on the compositor. Second, the storage options — cookies, localStorage, sessionStorage, and IndexedDB — each with different size limits, lifetimes, synchronicity, and whether they ride along on every request.
The security model is part of the platform too: the same-origin policy is the default that keeps one site from reading another, and CORS is the controlled exception. The scheduling and observation APIs — requestAnimationFrame, IntersectionObserver, requestIdleCallback — exist because polling and scroll handlers are how you jank a page. These questions build from the rendering path up through storage and events into the observer APIs, so that when a framework does something surprising, you can explain it from the layer below.
Easy
- localStorage vs sessionStorage vs cookies Storage
Compare the three client storage mechanisms: capacity, lifetime, scope, and whether they're sent to the server.
Medium
- What happens when you type a URL and hit Enter? Networking
Walk through everything from the keystroke to pixels on screen. This is the classic 'do you understand the whole stack' question. - The critical rendering path Rendering
How does the browser turn HTML, CSS, and JS into pixels? Why is CSS render-blocking and where does JS block parsing? - Event bubbling, capturing & delegation Events
Explain the three phases of event propagation, then use delegation to handle clicks on a list with one listener. Click the items in the… - Cookie attributes: HttpOnly, Secure, SameSite Security
What do the HttpOnly, Secure, SameSite, Domain/Path, and Expires/Max-Age cookie attributes control, and how do they defend against attacks? - fetch + AbortController Networking
Use the Fetch API to load JSON with proper error handling, and cancel an in-flight request with AbortController (e.g. a timeout or a… - requestAnimationFrame Animation
Why animate with requestAnimationFrame instead of setInterval? Run the demo to count frames rendered in ~500ms. - IntersectionObserver (lazy loading & infinite scroll) Observers
How do you detect when an element enters the viewport without janky scroll listeners? Implement lazy-loading with IntersectionObserver.
Hard
- Reflow vs repaint Rendering
What's the difference between a reflow and a repaint? Which DOM/CSS operations trigger each, and how do you avoid layout thrashing? - Same-origin policy & CORS Security
What defines an 'origin'? What does the same-origin policy block, and how does CORS selectively relax it? Explain preflight requests. - XSS: textContent vs innerHTML Security
Why is assigning user input to innerHTML dangerous? Run the demo — the safe box shows text, the unsafe box executes an injected handler. - CSR vs SSR vs SSG & hydration Rendering Strategy
Compare client-side rendering, server-side rendering, and static generation. What is hydration, and what trade-offs drive the choice?
Other topics
HTML/CSS · JavaScript · TypeScript · React · System Design · Accessibility · Web Performance · Testing · Networking/Security · DSA