HTML5 & Web APIs (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What are Resource Hints (`preload`, `prefetch`, `preconnect`, `dns-prefetch`)?
senior LevelCode ExampleSystem DesignRabbitMQHTTP & REST APIs
In Simple Words: Informs the browser's network stack about resources before the HTML parser discovers them:
rel="preconnect": Initiates early DNS lookup, TCP handshake, and TLS negotiation to an external origin (e.g., Google Fonts or Cloudinary CDN):html<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />rel="preload": Tells the browser to download a critical resource needed for the current page immediately with high priority (hero images, critical fonts, main JS bundle):html<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin />rel="prefetch": Low-priority background download of resources likely needed for the next page navigation (e.g. checkout bundle while on cart page).