
Website performance depends not only on how quickly a server responds but also on how efficiently a browser discovers, connects to and downloads the resources required by a page.
A browser may need to download HTML, CSS, JavaScript, images, fonts and other files before a page becomes fully usable. Some resources are essential immediately, while others are needed only after a user navigates to another page or performs an action.
Web performance resource hints help developers communicate these requirements to browsers in advance. They allow browsers to prepare network connections, fetch important resources earlier or retrieve likely future resources when appropriate.
Resource hints include preload, prefetch, preconnect, dns-prefetch and modulepreload. Related techniques, such as fetch priority and the Speculation Rules API, provide additional control over resource loading and future navigation.
This guide explains how resource hints work, when to use each technique, how to implement them in HTML and modern web applications, and how to measure their impact.
Resource hints are instructions that help a browser anticipate resource requirements before it would normally discover or request them.
For example, a website may use a custom font hosted on a separate domain. Without an early hint, the browser might first download and parse the stylesheet before discovering the font file.
A suitable resource hint can help the browser prepare the connection or fetch the font earlier.
Resource hints are generally placed inside the HTML <head> element. Some can also be delivered through HTTP response headers.
They are hints rather than commands that guarantee a particular loading schedule. The browser can consider network conditions, available resources, priorities and its own loading policies.
Resource hints can improve perceived loading speed by reducing delays between resource discovery and resource delivery.
Their potential benefits include:
Reducing connection setup delays for important third-party resources.
Making critical images and fonts available earlier.
Preparing JavaScript modules before they are needed.
Improving navigation to likely next pages.
Helping browsers prioritise resources that affect the visible page.
Reducing avoidable waiting during resource discovery.
However, resource hints do not automatically make every website faster. Incorrect or excessive hints can compete with critical resources for bandwidth and processing time.
The goal is to prioritise resources based on their actual importance.
preload tells the browser that a resource is important for the current page and should be fetched early.
It is useful when the browser might otherwise discover a critical resource too late.
Example:
<link
rel="preload"
href="/assets/hero-image.webp"
as="image"
>
This tells the browser to begin fetching the hero image early.
Preload can be used for different resource types, including:
Images.
Fonts.
Stylesheets.
JavaScript.
Audio and video resources.
Fetch requests.
For a font:
<link
rel="preload"
href="/fonts/site-regular.woff2"
as="font"
type="font/woff2"
crossorigin
>
The as attribute identifies the resource type and helps the browser apply appropriate request handling and prioritisation.
For cross-origin fonts, the crossorigin attribute is important for matching the font's request mode and allowing the browser to reuse the preload.
When to use preload: Use it for resources that are needed early on the current page, particularly when their discovery would otherwise be delayed.
Do not preload every image, script or stylesheet. Unnecessary preloads can compete with genuinely critical resources.
prefetch suggests that the browser fetch a resource that may be needed during a future navigation.
Example:
<link
rel="prefetch"
href="/products.html"
>
If a visitor is reading a category page and is likely to open a product page next, prefetching may reduce the delay when that navigation happens.
Prefetch is generally intended for resources that may be required in the near future rather than resources needed immediately for the current page.
Important considerations include:
The browser may decide not to perform the request.
Network conditions and browser policies affect speculative fetching.
Prefetched responses may be subject to caching rules.
Prefetching resources that are never used wastes bandwidth.
When to use prefetch: Use it when there is a reasonable expectation that a user will navigate to a particular page or need a particular resource soon.
preconnect tells the browser to establish an early connection to another origin.
Connecting to a server can involve several steps, including DNS resolution, establishing a transport connection and negotiating TLS for HTTPS.
Example:
<link
rel="preconnect"
href="https://cdn.example.com"
>
The browser can begin preparing the connection before the page requests a resource from that origin.
For cross-origin fonts, a common pattern is:
<link
rel="preconnect"
href="https://fonts.example.com"
crossorigin
>
Preconnect is useful when a page will soon request important resources from another domain, such as a CDN or font host.
However, establishing connections to too many origins can waste resources. Use it selectively for important origins that are likely to be contacted soon.
dns-prefetch tells the browser to resolve a domain name before it needs to request a resource from that domain.
Example:
<link
rel="dns-prefetch"
href="//analytics.example.com"
>
DNS resolution converts a domain name into network address information required to connect to a server.
DNS prefetch prepares this step but does not establish the full connection.
It is generally lighter than preconnect and can be useful for additional third-party domains that are likely to be used later.
A page can combine preconnect and DNS prefetch:
<link
rel="preconnect"
href="https://cdn.example.com"
>
<link
rel="dns-prefetch"
href="//analytics.example.com"
>
When to use DNS prefetch: Use it when you want to reduce DNS lookup delays for a likely future cross-origin request but do not need to establish the complete connection immediately.
Modern JavaScript applications often use ES modules with dependencies imported from other files.
modulepreload tells the browser to fetch and prepare an important JavaScript module early.
Example:
<link
rel="modulepreload"
href="/assets/main.js"
>
Unlike an ordinary preload of a script resource, modulepreload is designed specifically for JavaScript modules. It can integrate the fetched module into the browser's module loading process, including parsing and compilation preparation.
This can be helpful when an application has important module dependencies that would otherwise be discovered later.
When to use modulepreload: Use it for important JavaScript modules when early preparation is likely to improve the startup experience.
Fetch Priority is a browser feature that allows developers to provide additional priority information for certain resource requests.
It uses the fetchpriority attribute with values such as:
high
low
auto
Example:
<img
src="/images/hero.webp"
alt="Main banner"
fetchpriority="high"
>
This suggests that the image should receive higher loading priority.
A lower priority can be useful for images that are not immediately important:
<img
src="/images/footer-decoration.webp"
alt=""
fetchpriority="low"
>
Fetch priority is a prioritisation hint, not a guarantee that a resource will be downloaded first.
It can also be used with suitable preload declarations:
<link
rel="preload"
href="/images/hero.webp"
as="image"
fetchpriority="high"
>
Developers should avoid assigning high priority to too many resources. If everything is marked as important, the browser receives little useful prioritisation guidance.
The Speculation Rules API provides a way to describe which future page navigations a browser may prefetch or prerender.
Unlike ordinary resource hints that primarily deal with individual resources or origins, speculation rules can describe likely future document navigations.
A simplified example:
<script type="speculationrules">
{
"prefetch": [
{
"source": "list",
"urls": ["/products", "/contact"]
}
]
}
</script>
This example suggests that the browser may prefetch the listed pages.
Prerendering goes further by allowing a browser to prepare a future page for a potentially faster navigation. It can involve more resource and processing work than prefetching.
Speculation Rules should be applied carefully. Developers must consider:
Whether a user is genuinely likely to visit the target page.
Whether the target page performs actions or has side effects.
Privacy and security implications.
Network and device constraints.
Browser support and implementation policies.
For pages that depend on user-specific information, applications should be especially careful about speculative requests and access controls.
Resource hints are commonly placed in the <head> section so the browser can discover them early.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link
rel="preconnect"
href="https://cdn.example.com"
>
<link
rel="preload"
href="/assets/hero.webp"
as="image"
fetchpriority="high"
>
<link
rel="preload"
href="/fonts/site.woff2"
as="font"
type="font/woff2"
crossorigin
>
<link
rel="prefetch"
href="/products.html"
>
<title>Resource Hints Demo</title>
</head>
<body>
<h1>Welcome to the Website</h1>
<img
src="/assets/hero.webp"
alt="Website hero"
fetchpriority="high"
>
</body>
</html>
This example demonstrates several resource hints. In a real application, each hint should be included only if it serves a measured performance requirement.
Resource hints can be included in the HTML document used by a React application.
For example, in a typical project with a public HTML entry point:
<head>
<link
rel="preconnect"
href="https://cdn.example.com"
>
<link
rel="preload"
href="/assets/hero.webp"
as="image"
fetchpriority="high"
>
</head>
For a framework that supports document-level metadata or resource hint components, use its recommended approach.
A React component can also set fetch priority on an image:
function HeroSection() {
return (
<section>
<img
src="/assets/hero.webp"
alt="Main website banner"
fetchPriority="high"
/>
</section>
);
}
export default HeroSection;
React uses the camelCase prop fetchPriority.
The best location for resource hints depends on the rendering framework and whether the page uses server-side rendering, static generation or client-side rendering.
Server-rendered applications can send resource hints through HTML or suitable HTTP response headers.
For example, an HTTP Link header may communicate a preload instruction:
Link: </assets/hero.webp>; rel=preload; as=image
A preconnect header can also be used:
Link: <https://cdn.example.com>; rel=preconnect
The server should emit hints only for resources relevant to the requested page.
Server-rendered frameworks may provide their own mechanisms for prioritising images, fonts and scripts. Developers should avoid duplicating hints already generated by the framework.
The correct hint depends on when the resource is required.
Use preload when a critical resource is needed on the current page and would otherwise be discovered late.
Use prefetch when a resource is likely to be needed on a future page or interaction.
Use preconnect when an important cross-origin server will be contacted soon.
Use DNS prefetch when preparing DNS resolution is useful but a full early connection is unnecessary.
Use modulepreload when an important JavaScript module should be fetched and prepared before normal module discovery reaches it.
Use fetchpriority when the browser needs an additional signal about the relative importance of a resource.
These techniques solve different problems and should not be treated as interchangeable.
Resource hints can influence loading behaviour that contributes to user-perceived performance.
LCP measures when the largest relevant content element in the visible viewport is rendered.
If the LCP element is an image that is discovered late, a carefully selected preload or high fetch priority may help it load sooner.
However, the best first step is often to make the important image discoverable in the initial HTML rather than relying on JavaScript to insert it later.
FCP measures when the browser first renders content from the page.
Reducing delays in critical resource discovery and connection setup may help the browser reach this milestone sooner.
CLS measures unexpected visual layout movement.
Preloading an essential font can sometimes reduce delayed font swapping, but developers should also use appropriate font fallbacks and layout-compatible font metrics.
Resource hints alone do not guarantee a good CLS score.
INP measures the responsiveness of interactions throughout a page visit.
Resource hints primarily affect resource loading. They do not directly fix slow event handlers, expensive JavaScript execution or long main-thread tasks.
A complete performance strategy must address both loading and interaction responsiveness.
Resource hints should be tested instead of added based on assumptions.
Useful testing methods include:
The browser Network panel shows:
Requested resource URLs.
Request start times.
Download duration.
Resource types.
Initiator information.
Priority information where available.
Cache behaviour.
Use it to check whether the browser fetches the intended resource early and whether duplicate downloads occur.
Lighthouse can help identify performance opportunities and issues related to resource discovery, prioritisation and connection setup.
Review the report rather than assuming that adding a particular hint will automatically improve the score.
The Performance panel helps inspect loading activity, rendering events and network-related delays.
It can help determine whether a resource is actually blocking or delaying an important page element.
PageSpeed Insights provides performance information and field data where available.
Compare results before and after a change, using the same page and comparable test conditions.
Laboratory tests are useful, but actual visitors use different devices, browsers and network connections.
Real User Monitoring can help determine whether a change improves performance across real sessions.
Preloading unnecessary resources can compete with critical images, stylesheets and scripts.
Only preload resources that are genuinely important to the current page.
Prefetch is intended for likely future needs. It should not replace preload for an important resource needed during the current page load.
Each early connection can consume network and processing resources.
Limit preconnect to origins that are important and likely to be used soon.
The as attribute should match the type of resource being preloaded.
An incorrect value can interfere with prioritisation, request handling or reuse.
Cross-origin font preloads generally need the appropriate crossorigin attribute so the browser can reuse the fetched resource.
A preload and the later resource request should match in URL and relevant request settings. Differences can cause the browser to fetch the resource again.
A strategy that works on a fast desktop connection may create unnecessary competition on a slower mobile connection.
Test on different network and device conditions.
Browsers make their own decisions about resource fetching and scheduling. A hint does not guarantee a specific request time or priority.
Identify critical resources before adding hints.
Make important images discoverable in the initial HTML.
Use preload selectively for current-page resources.
Use prefetch only for plausible future navigation or resource needs.
Preconnect only to essential cross-origin services.
Use DNS prefetch for less critical external origins where useful.
Include the correct as, type and crossorigin attributes.
Use fetch priority selectively.
Avoid duplicating hints generated by frameworks.
Test on mobile devices and slower connections.
Compare performance before and after implementation.
Revisit hints when page structure or resource delivery changes.
Build a landing page with a large hero image.
Measure its loading behaviour before and after adding preload and fetch priority. Compare the results in browser developer tools.
Create a webpage using a locally hosted web font.
Test font loading with and without preload. Inspect whether the browser reuses the preloaded file and whether visible text rendering improves.
Load assets from a separate development server or CDN.
Compare requests with no connection hint, DNS prefetch and preconnect. Observe connection timing in the Network panel.
Create a small multi-page website with a home page and product page.
Add a prefetch hint for a likely next page and compare navigation behaviour under suitable test conditions.
Build a page containing a hero image, product images, fonts and JavaScript files.
Review their priorities and apply selective preload and fetch priority. Document the impact on loading performance.
Developers working with resource loading optimisation should understand:
HTML document structure and the <link> element.
Browser resource discovery.
DNS resolution and network connections.
HTTP requests and response headers.
Cross-origin resource loading and CORS.
JavaScript modules.
Browser caching behaviour.
Core Web Vitals.
Browser developer tools.
Performance testing and monitoring.
Server-side rendering and frontend frameworks.
These skills are useful for frontend development, web performance engineering and technical website optimisation.
Knowledge of resource loading and browser performance can support several technical roles.
Frontend Developer: Builds responsive interfaces and improves how important page resources load.
Web Performance Engineer: Investigates loading bottlenecks, resource priorities and user experience metrics.
JavaScript Developer: Optimises application startup and module delivery.
Technical SEO Specialist: Works with website performance and technical factors that contribute to search experience.
Full Stack Developer: Optimises both server-delivered resources and frontend loading behaviour.
Practical performance projects and the ability to explain measurable improvements can strengthen a developer's technical portfolio.
Follow this learning sequence:
Understand how browsers discover HTML, CSS, JavaScript, images and fonts.
Learn how DNS resolution and HTTPS connections work.
Study preload, prefetch, preconnect and DNS prefetch.
Understand modulepreload and JavaScript module loading.
Learn fetch priority and resource scheduling.
Explore the Speculation Rules API.
Practise adding hints to a simple HTML website.
Test resource behaviour in browser developer tools.
Measure Core Web Vitals and loading performance.
Build a project that compares performance before and after optimisation.
You can explore additional learning resources through EasyShiksha Online Courses, search for relevant topics through EasyShiksha Course Search, and explore the Web Development learning section.
Web performance resource hints help browsers prepare for important resource requests and likely future navigation. Preload, prefetch, preconnect, DNS prefetch and modulepreload each address a different part of the loading process.
When used carefully, these techniques can reduce avoidable delays and improve the experience of loading a website. When used excessively, they can waste bandwidth and compete with resources that matter more.
The most effective approach is to identify critical resources, select the appropriate hint, test browser behaviour and measure the result under realistic conditions.
Resource hints are browser instructions that help prepare network connections or fetch resources before they would normally be requested. They can improve resource discovery and loading when used appropriately.
Preload is intended for important resources needed by the current page. Prefetch suggests fetching resources that may be required during a future navigation or later activity.
Preconnect allows the browser to begin establishing a connection to another origin before the page requests resources from it. This can reduce connection setup delays.
DNS prefetch allows the browser to resolve a domain name before a request is made. It prepares DNS resolution but does not establish the complete network connection.
Modulepreload allows the browser to fetch and prepare an important JavaScript module before normal module discovery reaches it. It is designed specifically for JavaScript modules.
Resource hints are commonly placed in the HTML document's <head> section so the browser can discover them early. Suitable hints can also be delivered through HTTP Link headers.
No. Preload communicates that a resource is important, but the browser still controls scheduling and prioritisation based on its own policies and available resources.
Yes. Excessive preloads, prefetches or early connections can consume bandwidth and processing resources that should be available for more important requests.
The fetchpriority attribute provides a priority hint for supported resource requests. Its values include high, low and auto.
If the largest visible content is an image or another resource that the browser discovers late, a correctly configured preload may help it become available sooner and potentially improve LCP.
Font requests commonly use CORS-enabled request handling. The crossorigin attribute helps the preload use compatible request settings so the browser can reuse the fetched font.
Yes. Developers can include suitable hints in the HTML document or use the resource-loading mechanisms provided by their React framework. React components can also use supported resource priority attributes.
DNS prefetch prepares only the DNS lookup. Preconnect can prepare DNS resolution, the transport connection and, for HTTPS, the TLS handshake.
The Speculation Rules API lets developers describe future page navigations that browsers may prefetch or prerender. It can improve navigation speed when predictions are accurate and the browser supports the required behaviour.
Resource hints do not guarantee higher search rankings. They can contribute to better loading performance, which may improve user experience and support performance-related aspects of website quality.
Use the browser Network panel to inspect request timing, initiators, resource types and duplicate requests. Performance tools can help determine whether the preloaded resource improves the intended loading milestone.
No. High priority should be reserved for genuinely important images, such as a likely LCP image. Giving many images high priority can reduce the usefulness of the signal.
Prefetch fetches resources or a future document without necessarily rendering the page. Prerender prepares a future page more completely so navigation may become faster, but it can consume more resources.
Support varies by hint and browser version. Developers should check current compatibility information and ensure that the website continues to work correctly when a browser ignores a hint.
Build a small website, test preload and preconnect, experiment with prefetch and modulepreload, and compare network timing and performance measurements. Practical testing helps identify when each hint provides a real benefit.
More News Click here
Discover thousands of colleges and courses, enhance skills with online courses and internships, explore career alternatives, and stay updated with the latest educational news..
Gain high-quality, filtered student leads, prominent homepage ads, top search ranking, and a separate website. Let us actively enhance your brand awareness.