Avoiding Unused Preload Warnings
Understand and fix 'The resource was preloaded using link preload but not used' browser console warnings. Learn the common causes and correct solutions.
Detailed Explanation
Avoiding Unused Preload Warnings
The browser console warning "The resource ... was preloaded using link preload but not used within a few seconds from the window's load event" indicates that a preloaded resource was never consumed by the page. This wastes bandwidth and can actually hurt performance.
Common Causes
1. URL Mismatch
The most frequent cause. The preload URL must exactly match the URL used by the consuming element:
<!-- WRONG: URLs don't match (with vs without query string) -->
<link rel="preload" href="/style.css" as="style" />
<link rel="stylesheet" href="/style.css?v=2" />
<!-- CORRECT: exact URL match -->
<link rel="preload" href="/style.css?v=2" as="style" />
<link rel="stylesheet" href="/style.css?v=2" />
2. Missing crossorigin Match
For CORS resources (especially fonts), the crossorigin attribute must match:
<!-- WRONG: preload has no crossorigin, @font-face uses CORS -->
<link rel="preload" href="/font.woff2" as="font" type="font/woff2" />
<!-- CORRECT: crossorigin matches @font-face CORS mode -->
<link rel="preload" href="/font.woff2" as="font" type="font/woff2"
crossorigin="anonymous" />
3. Conditional Resources Not Needed
Preloading a resource that is only used under certain conditions:
<!-- PROBLEMATIC: only used if user clicks a button -->
<link rel="preload" href="/modal.js" as="script" />
Solution: use prefetch instead for resources that may not be needed.
4. Removed or Refactored Resources
After a code refactor, preload tags may reference files that no longer exist or have been renamed. Regular auditing of preload tags is essential.
5. Media Query Mismatch
The preload's media query doesn't match any viewport:
<!-- Loaded on mobile but preloaded for desktop only -->
<link rel="preload" href="/hero-desktop.webp" as="image"
media="(min-width: 1200px)" />
<!-- User is on a 768px viewport — resource is unused -->
Debugging Steps
- Open Chrome DevTools > Console — look for the yellow warning
- Check the Network panel — filter by the resource name and verify the URL
- Compare the preload URL with the actual resource URL — including query strings, hashes, and protocols
- Check
crossoriginattributes — they must match between preload and consuming element - Verify the resource is actually used on the current page (not just on other pages)
Prevention Strategy
- Preload only resources you are certain will be used on the current page
- Use prefetch for resources that may be needed on future navigations
- Audit preload tags when changing asset URLs, adding cache busters, or renaming files
- Use automated testing (Lighthouse, WebPageTest) to catch unused preloads
Use Case
A development team notices 4 unused preload warnings in their browser console after a site redesign. Three are caused by URL mismatches (cache-busting query strings changed), and one is a font preload missing the crossorigin attribute. After fixing the URLs and adding crossorigin="anonymous", all warnings disappear and the font stops being downloaded twice.
Try It — Preload Generator
Related Topics
Preloading Web Fonts with Crossorigin
Preload Use Cases
Preloading Critical CSS for Faster First Paint
Preload Use Cases
Preload vs Prefetch — When to Use Each Resource Hint
Fundamentals
Preloading Hero Images for Better LCP
Preload Use Cases
Resource Hints Best Practices and Common Pitfalls
Practical Scenarios