Skip to content

Skip prefetching anchors with the download attribute#490

Open
sankalpsthakur wants to merge 3 commits into
GoogleChromeLabs:mainfrom
sankalpsthakur:skip-download-attr-prefetch
Open

Skip prefetching anchors with the download attribute#490
sankalpsthakur wants to merge 3 commits into
GoogleChromeLabs:mainfrom
sankalpsthakur:skip-download-attr-prefetch

Conversation

@sankalpsthakur

@sankalpsthakur sankalpsthakur commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Do not observe / prefetch <a download> links by default (boolean or named download attribute)
  • Applies in both listen (src/index.mjs) and the chunks path (src/chunks.mjs)
  • Adds a fixture + puppeteer test and a short README note under Custom Ignore Patterns

Fixes #181

Why this matters

Download links often target large binaries (PDFs, archives, exports). Prefetching them wastes bandwidth and cache space on paths the user may never follow — especially on metered or Save-Data connections where quicklink already throttles prefetch. Treating download like other built-in ignore patterns (external origins, rel=nofollow, etc.) keeps prefetch focused on navigational routes.

Test plan

  • npm test (19/19 passing)
  • npm run size (within limits)
  • npm run lint
  • Confirm CLA check passes for @sankalpsthakur

@google-cla

google-cla Bot commented Jul 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@sankalpsthakur

sankalpsthakur commented Jul 22, 2026

Copy link
Copy Markdown
Author

CLA signed for @sankalpsthakur / sankalphimself@gmail.com. cla/google is green.

@sankalpsthakur
sankalpsthakur force-pushed the skip-download-attr-prefetch branch 2 times, most recently from ad00787 to 6553f38 Compare July 22, 2026 09:03
sankalpsthakur and others added 3 commits July 26, 2026 14:56
Links marked for download often point at large binary payloads; excluding
them by default avoids wasted bandwidth while keeping ignores for custom cases.
@XhmikosR
XhmikosR force-pushed the skip-download-attr-prefetch branch from 68c515e to 9cd17fd Compare July 26, 2026 11:56
@XhmikosR XhmikosR added the enhancement New feature or request label Jul 26, 2026
@XhmikosR
XhmikosR requested a review from addyosmani July 26, 2026 11:57
@XhmikosR XhmikosR added the squash Squash PR label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request squash Squash PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not prefetch links with download attribute

2 participants