Monday, March 9, 2015

the download attribute on a link

when the user clicks the link, the download attribute appears in the save dialog instead of the garbled mess that was there before. In this case, the file will be downloaded as expenses.pdf. The download attribute also triggers a force download.

<!-- will download as "test.pdf" -->
<a href="/files/test.pdf" download="test.pdf">Download test.pdf</a>

Reference:

http://davidwalsh.name/download-attribute

No comments: