coderef

downloadBaseline · Widely available

The download attribute for <a> elements loads the target URL as a file to be saved, instead of navigating to it. An optional attribute value sets a default file name.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 19, 2019. Widely available since Mar 19, 2022.

Browser support

DesktopChrome
1–13Not supported
14+Supportedsince Sep 16, 2011
Current: 155
Edge
12–17Not supported
18+Supportedsince Oct 2, 2018
Current: 154
Firefox
1–19Not supported
20+Supportedsince Apr 2, 2013
Current: 157
Safari
1–10Not supported
10.1+Supportedsince Mar 27, 2017
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4–19Not supported
20+Supportedsince Apr 2, 2013
Current: 157
Safari iOS
1–12.2Not supported
13+Supportedsince Sep 19, 2019
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: download.

Feature detection

JS · check before using
if ("HTMLAnchorElement" in globalThis && "download" in HTMLAnchorElement.prototype) {
  // HTMLAnchorElement.download is available
}

Sub-features

Support for each part of the feature (6). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLAnchorElement.download15132010.1182010.3
HTMLAreaElement.download54132010.1542010.3
SVGAElement.download14214220✕14220✕
a.download14182010.1182013
area.download54122010.1542010.3
a.download14214220✕14220✕