Back
Web Fundamentals

Resource Hints: Preload, Prefetch & Preconnect

Web Fundamentals
Build & Deployment: Monorepo, CI/CD, Strategies & Release SafetyState Management: Choosing the Right SolutionRedux: Predictable State Container (RTK + RTK Query)React Query (TanStack Query): Server State CachingData Fetching Patterns: REST, GraphQL, tRPC & Real-timeGraphQL Fundamentals for Frontend: Shape, Caching, and TradeoffsgRPC-Web Fundamentals: Browser Constraints and Proxy ModelCaching Strategies: Client, Server & EdgeData Normalization: Organizing State for PerformanceAPI Design Best Practices: Pagination, Errors, Versioning & Type SafetyAPI Versioning Strategies for Frontend CompatibilityPagination: Offset vs Cursor-BasedRate Limiting & API Resilience: Retries, Backoff, Jitter, IdempotencyHow Frontend Developers Can Handle Millions of API Requests Without Crashing EverythingBrowser Storage: Cookies, SessionStorage, LocalStorage, IndexedDBReal-time Communication: WebSockets, SSE & PollingWebRTC: Real-Time Communication in the BrowserCore Web Vitals: LCP, INP & CLSPerformance Optimization Trade-offsCritical Resource Prioritization: Optimize Loading OrderCode Splitting: Optimize Bundle Size with Dynamic ImportsTree Shaking: Eliminate Dead Code from Your BundleLazy Loading: Load Resources On-DemandResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip and BrotliImage & Video Optimization: Modern Formats & TechniquesAdaptive Loading: Optimize for Device & NetworkList Virtualization: Render Large Lists EfficientlyWeb Workers vs Main Thread: Offloading Heavy WorkMemory Leaks in Frontend Apps: Detection & PreventionManaging Third-Party Scripts: Optimization StrategiesHow CDNs Work: Edge Delivery, Caching & PerformanceHTTP Caching Deep Dive: Cache-Control, ETag & RevalidationService Workers & Offline Strategy: Cache First, Network First & Update LifecyclePWA Fundamentals: Manifest, Installability & Offline UXCritical Rendering PathScript Loading: async vs deferEvent Loop: Understanding JavaScript Execution ModelJavaScript Module Systems: CJS vs ESM vs UMDDynamic Module Loading: import() FunctionImport on Interaction: Load When User InteractsImport on Visibility: Lazy Loading with IntersectionObserverBrowser Rendering Pipeline & Layout ThrashingRendering Strategies: CSR vs SSR vs SSG vs ISRStreaming SSR: Progressive HTML StreamingIslands Architecture: Independent Component HydrationReact Server Components: Zero-JS Server RenderingFramework Reactivity: React, Vue, Svelte & SolidHTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceDNS Resolution: Path, TTL, Caching & Frontend ImpactCross-Site Scripting (XSS) AttacksCross-Site Request Forgery (CSRF) AttacksCORS Explained: Cross-Origin Resource SharingCORS Preflight in Practice: Credentials, Simple Requests & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? Understanding TLS/SSLAuthorization Best PracticesCookie Security & Session Hardening: SameSite, HttpOnly, Secure
mediumPerformance

Resource Hints: Preload, Prefetch & Preconnect

TL;DRpreload = critical now • prefetch = likely next • preconnect = early connection setup
High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

Resource hints tell the browser how to prioritize network requests. Preload fetches critical assets for the current page, prefetch loads likely future resources, and preconnect warms up important origins early. Used correctly, they significantly improve LCP and overall loading performance.

Preload = first-class passengers who must board immediately (critical fonts, hero image). Prefetch = standby passengers for the next flight (likely next page). Preconnect = ground crew preparing the gate early for important destinations.

Identify Critical Resources
Preload (Current Page)
Prefetch (Next Likely Page)
Preconnect (External Origins)

1Preload – Critical Resources

Tells the browser to fetch important assets with high priority for the current navigation. Ideal for LCP images, critical fonts, and essential JS/CSS.

head.htmlhtml
<link rel="preload" href="/fonts/inter.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/hero.webp" as="image">

2Prefetch – Future Resources

Low-priority hint for resources likely needed in the near future (next page, heavy components). Browser may skip under network pressure.

3Preconnect & DNS-Prefetch

Preconnect establishes early DNS + TCP + TLS for important third-party domains. DNS-prefetch is a lighter DNS-only version.

Propertypreloadprefetchpreconnect
RiskCan compete with other critical requests if overusedMay be ignored under contentionToo many can waste connections
ExamplesHero image, Critical font, Critical CSSNext page JS, Dashboard dataapi.example.com, fonts.googleapis.com
PriorityHighLow / SpeculativeMedium
Use CaseCurrent page critical assetsLikely next navigationExternal APIs & CDNs

preload

Risk

Can compete with other critical requests if overused

Examples

Hero image, Critical font, Critical CSS

Priority

High

Use Case

Current page critical assets

prefetch

Risk

May be ignored under contention

Examples

Next page JS, Dashboard data

Priority

Low / Speculative

Use Case

Likely next navigation

preconnect

Risk

Too many can waste connections

Examples

api.example.com, fonts.googleapis.com

Priority

Medium

Use Case

External APIs & CDNs

Common questions

  • ›“What is the difference between preload and prefetch?”
  • ›“How do you optimize LCP with resource hints?”
  • ›“When should you use preconnect?”
  • ›“How do resource hints affect Core Web Vitals?”

What interviewers look for

  • Clear understanding of priority and timing
  • Knowledge of correct attributes (as, crossorigin)
  • Awareness of trade-offs and over-use risks
  • Connection to real metrics (LCP, TTFB)

Short answer (60 sec)

Preload critical assets for the current page (high priority). Prefetch likely future resources (low priority). Preconnect to important third-party origins early. Use sparingly and validate impact.

Detailed answer (senior level)

Resource hints give the browser explicit loading instructions. Preload is high-priority for current navigation and directly helps LCP. Prefetch is speculative for next actions. Preconnect warms up cross-origin connections. Always include proper 'as' attributes and crossorigin for fonts. Overusing hints can hurt performance by saturating bandwidth — measure with real-user data.

  • Preloading too many resources (bandwidth contention)
  • Missing 'as' attribute on preload
  • Forgetting crossorigin on fonts
  • Using prefetch for critical current-page resources
  • Not measuring impact after adding hints
Key Takeaways
  • ✓Preload critical resources needed for current page
  • ✓Prefetch for likely next navigation
  • ✓Preconnect to important external domains
  • ✓Always specify 'as' and crossorigin where needed
  • ✓Hints are priority signals — use them judiciously
  • ✓Validate with Lighthouse and real-user metrics
  • ✓Combine with critical CSS and lazy loading for best results
Previous TopicLazy Loading: Load Resources On-DemandNext Topic Text Compression: Gzip and Brotli

On this page