HTMLAnchorElement.download

HTMLAnchorElement.download属性是一个DOMString ,表明链接的资源将被下载,而不是显示在浏览器中。该值表示下载文件的建议名称。如果该名称不是基础操作系统的有效文件名,浏览器将对其进行调整。

注意: 该值对于下载行为来说不一定是有用的,同时也不能决定下载行为是否发生。

语法

var dnload = anchorElt.download;
anchorElt.download = dnload;

规范Edit

Specification Status Comment
HTML Living Standard
download
Living Standard No change from Document Object Model (DOM) Level 2 HTML Specification

浏览器的兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
downloadChrome Full support 14Edge Full support 13Firefox Full support 20IE No support NoOpera Full support 15Safari Full support YesWebView Android Full support YesChrome Android Full support 18Firefox Android Full support YesOpera Android Full support YesSafari iOS ? Samsung Internet Android Full support 1.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown