Syntax
<a href="report.txt" download="report.txt">Download report</a>Examples
Download Links and Suggested Filenames: working example
Save as an HTML file and open it in a browser. Expected result: Activating the link requests a small text download named greeting.txt containing Hello Ada and a newline.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Working example</title>
</head>
<body>
<a href="data:text/plain;charset=utf-8,Hello%20Ada%0A" download="greeting.txt">Download greeting</a>
</body>
</html>- Expected result: Activating the link requests a small text download named greeting.txt containing Hello Ada and a newline.
- The data URL supplies the complete file so the example needs no server asset.
- The attribute value is a suggested filename rather than a local filesystem path.
Best practices
- Provide a descriptive link label and file type for larger downloads.
- Use a Blob URL for substantial generated content and release it when no longer needed.
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
<a> download
Desktop
- Chrome
- Supported
From 14 - Firefox
- Supported
From 20 - Safari
- Supported
From 10.1 - Edge
- Supported
From 18 - Opera
- Supported
From 15
Mobile
- Safari on iOS
- Supported
From 13 - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 20 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature
Support history and limitations
Chrome
- From 14 · Starting in Chrome 65, cross-origin downloads are not supported on the <a> element.
Firefox
- From 20
Safari
- From 10.1
Edge
- From 18 · Starting in Edge 79, cross-origin downloads are not supported on the <a> element.
- From 13 · Removed in 18 · Last supported version: 17 · Partial implementation · Until Edge 14 (build 14357), attempting to download data URIs caused Edge to crash (bug 7160092). · Edge 17 or older didn't follow the attributes' value to determine filename (bug 7260192).
Opera
- From 15 · Starting in Opera 52, cross-origin downloads are not supported on the <a> element.
Safari on iOS
- From 13
Chrome for Android
- From 18 · Starting in Chrome Android 65, cross-origin downloads are not supported on the <a> element.
Firefox for Android
- From 20 · The attribute's filename value only affects the suggested file name for the blob: and data: URI schemes. Other schemes ignore the suggested filename. See bug 1845642.
Samsung Internet
- From 1.0 · Starting in Samsung Browser 9.0, cross-origin downloads are not supported on the <a> element.
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.