HTML download attribute works in Chrome 14+, Edge 13+, Firefox 20+, Safari 10.1+, Opera 15+. See how to set a filename, why CORS blocks it, and known issues.

Prince Dewani
May 6, 2026
The HTML download attribute is a WHATWG attribute on an anchor element that tells the browser to save the linked resource to disk instead of navigating to it. It works in Chrome 14+, Edge 13+, Firefox 20+, Safari 10.1+ on macOS, Safari 13+ on iOS, Opera 15+, Samsung Internet 4+, and Android Browser 4.4+; Internet Explorer never supports it.
This guide covers what the attribute is, the browsers that support it, how to use it, why it fails on cross-origin URLs, and the known issues.
The HTML download attribute is a boolean-or-string attribute defined by WHATWG on the anchor and area elements. When set, the browser treats the linked URL as a file to save rather than a page to open. The optional value supplies the suggested filename for the saved file.
The HTML download attribute is baseline widely available across every major desktop and mobile browser, with one notable hole: Internet Explorer never shipped support, and every browser blocks the filename hint on cross-origin URLs.
Chrome supports the HTML download attribute from Chrome 14 on Windows, macOS, Linux, and ChromeOS, and from the same baseline on Chrome for Android. Chrome 65 tightened the cross-origin path: the filename hint is dropped for cross-origin URLs and some MIME types are blocked outright.
Edge supports the HTML download attribute from Edge 13 on the legacy EdgeHTML engine and from Edge 79 on the Chromium engine. The Chromium switch did not change the API surface, so any anchor with download keeps working when a tester upgrades from Edge Legacy.
Firefox supports the HTML download attribute from Firefox 20 on Windows, macOS, and Linux, and from the same baseline on Firefox for Android. Firefox ignores the entire attribute on cross-origin URLs and navigates to the resource instead, which is stricter than Chrome's behavior.
Safari supports the HTML download attribute from Safari 10.1 on macOS and from Safari 13 on iOS and iPadOS. Older Safari builds ignored the attribute and navigated to the file. Safari honors the attribute only for same-origin, blob, and data URLs.
Opera supports the HTML download attribute from Opera 15 on desktop, the first Chromium-based release, and from Opera Mobile 80 on Android. The legacy Presto Opera 9 to 12.1 line did not support it. Opera Mini still does not support it because of its proxy rendering model.
Samsung Internet supports the HTML download attribute from Samsung Internet 4 on Android. The browser tracks Chromium, so every later Samsung Internet release inherits the same cross-origin tightening that Chrome 65 introduced.
The Android Browser and the system WebView support the HTML download attribute from Android 4.4 KitKat on, when the WebView switched to Chromium. Stock browsers on the older WebKit-based WebView ignored the attribute and opened the file in the page.
Internet Explorer never supports the HTML download attribute. IE 5.5 to IE 11 ignore the attribute and follow the link. Pages that need a save prompt on IE 10 and 11 fall back to navigator.msSaveOrOpenBlob. Microsoft has retired Internet Explorer, so prefer Edge for any modern test pass.
Note: The HTML download attribute looks universal on a chart but breaks on cross-origin URLs, on Safari, and on Internet Explorer. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!
Add the download attribute to any anchor that points at a file the user should save. The attribute can stand alone, or it can take a string that the browser uses as the suggested filename. Same-origin, blob, and data URLs are the only paths that get the filename hint.
// Same-origin download with the HTML download attribute.
// Paste into the DevTools console on a page you control.
const a = document.createElement("a");
a.href = "/files/report.pdf";
a.download = "monthly-report.pdf";
a.textContent = "Download monthly report";
document.body.appendChild(a);
a.click();
// Build a CSV in the page and save it without a server hop.
const blob = new Blob(["name,score\nPrince,42"], { type: "text/csv" });
const blobLink = document.createElement("a");
blobLink.href = URL.createObjectURL(blob);
blobLink.download = "scores.csv";
blobLink.click();
URL.revokeObjectURL(blobLink.href);
// Console output: a Save As prompt for monthly-report.pdf, then for scores.csv.If the click opens the file in the browser instead of saving it, the page is sandboxed or the URL is cross-origin. Drop the iframe sandbox attribute or move the file to the same origin and re-run the test.
The same-origin policy treats a download with a forced filename as a privileged action. A page on one origin should not be able to rewrite a file's name as it lands on the user's disk, since the new name could disguise a malicious payload as a trusted document.
Each browser ships its own enforcement of the rule:
The HTML download attribute is a hint, not a contract. The browser, the user's settings, and the response headers all get a vote, and a page that ignores any one of them ships a broken download button.
In my experience, the cross-origin filename trap is the one that ships to production unnoticed; a designer tests on localhost where everything is same-origin, the QA pass on a CDN-hosted asset silently saves the wrong filename, and nobody notices until a customer complains.
All HTML download attribute version numbers and behavior notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance