HTML5 & Web APIs (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Resource Hints: `preload`, `prefetch`, `preconnect`, `dns-prefetch`, and `modulepreload`.
senior LevelCode ExampleSystem DesignRabbitMQHTTP & REST APIs
In Simple Words: Resource hints optimize browser network loading priorities:
dns-prefetch: Resolves DNS IP addresses of external domains in advance (low overhead).preconnect: Performs DNS resolution + TCP handshake + TLS negotiation in advance (e.g. for Google Fonts CDN).preload: High-priority instruction telling the browser to fetch a critical resource needed for the current page immediately (e.g. hero font or LCP image).prefetch: Low-priority hint telling the browser to fetch resources likely needed on the next user navigation when idle.modulepreload: Preloads and pre-parses ES module scripts into memory.
html
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
<link rel="prefetch" href="/checkout.js">