download

object download extends Attr

area - This attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. See <a title="The HTML <a> element (or anchor element) creates a hyperlink to other web pages, files, locations within the same page, email addresses, or any other URL." href="/en-US/docs/Web/HTML/Element/a"><code><a></code></a> for a full description of the <code><a href="/en-US/docs/Web/HTML/Element/a#attr-download">download</a></code> attribute. a - This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). There are no restrictions on allowed values, though <code>/</code> and <code></code> are converted to underscores. Most file systems limit some punctuation in file names, and browsers will adjust the suggested name accordingly.

<strong>Notes:</strong>

  • This attribute only works for <a href="/en-US/docs/Web/Security/Same-origin_policy">same-origin URLs</a>.
  • This attribute can be used with <a href="/en-US/docs/Web/API/URL.createObjectURL"><code>blob:</code> URLs</a> and <a href="/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs"><code>data:</code> URLs</a> to download content generated by JavaScript, such as pictures created in an image-editor Web app.
  • If the HTTP header <a href="/en-US/docs/Web/HTTP/Headers/Content-Disposition"><code>Content-Disposition:</code></a> gives a different filename than this attribute, the HTTP header takes priority over this attribute.
  • If <code>Content-Disposition:</code> is set to <code>inline</code>, Firefox prioritizes <code>Content-Disposition</code>, like the filename case, while Chrome prioritizes the <code>download</code> attribute.
trait Attr
class Object
trait Matchable
class Any

Type members

Classlikes

object tag extends TagElement

Inherited types

type supports[T <: Tag] = AttrPair[attrType] => AttrPair[tagType]
Inherited from
Attr

Value members

Concrete methods

@inline
def :=(v: Boolean): AttrPair[_download_attr]
@inline
def :=(v: Option[Boolean]): OptionalAttrPair[_download_attr]

Implicits

Implicits

@inline
implicit def boolToPairaApplied(attrObj: download): AttrPair[tag]
@inline
implicit def boolToPairareaApplied(attrObj: download): AttrPair[tag]
@inline
implicit def boolToPairstarApplied(attrObj: download): AttrPair[tag]