I want the anchor element’s download attribute to work for cross-origin links that opt in via CORS

Submitted by Brad Isbell

This idea is currently being discussed.

The download attribute on <a> elements lets me tell the browser to download a linked resource rather than navigate to it, and to suggest a filename. Today, however, this only works for same-origin URLs — the attribute is silently ignored for cross-origin links, even when the remote server explicitly allows cross-origin access via CORS headers.

This limitation was introduced over a decade ago out of concern that users might be tricked into unknowingly downloading and re-uploading a cross-origin file. While I appreciate the original caution, the current restriction creates real problems without meaningfully improving security:

The fix should follow the existing CORS model: if a server includes the appropriate Access-Control-Allow-Origin header, it has already opted in to cross-origin access. Honouring the download attribute in that case adds no new attack surface and removes a significant practical obstacle for developers building with CDNs and serverless architectures.

Tagged
HTML Api
Votes
0
What are votes for and how are they tallied?