Skip to content
RED SAGSkills
mediumFrontend Developer interview question

What happens between typing a URL in the browser and seeing the page rendered? Focus on the frontend side.

What the interviewer wants to hear

  • DNS lookup, TCP/TLS connection and the HTTP request for the HTML
  • The browser parses HTML into the DOM and CSS into the CSSOM
  • Scripts can block parsing unless they use defer, async or type module
  • DOM and CSSOM combine into the render tree, followed by layout, paint and compositing
  • Optimise the critical rendering path: less render-blocking CSS and JS, preload key resources

Model answer

The browser resolves the domain with DNS, opens a connection with TLS, and sends an HTTP request; caches and a CDN can shorten this. As the HTML streams in, the parser builds the DOM and the preload scanner starts fetching CSS, scripts and images it finds. CSS is parsed into the CSSOM and is render-blocking, because the browser will not paint without styles. A classic script without defer or async pauses parsing while it downloads and runs. Once DOM and CSSOM are ready, the browser builds the render tree, calculates layout, which is the size and position of every box, then paints pixels into layers and composites them on the GPU. Later changes from JavaScript can trigger layout or paint again. To speed this up I reduce render-blocking resources, inline critical CSS, defer scripts, preload the LCP image and fonts, and keep the HTML small so the first paint happens early.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Frontend Developer questions