ButtonsLesson 107Free preview
Download Buttons
This lesson is part of How To · All levels
Summary
A download button is a link that is given the button-style to download a file. The download attribute on the anchor asks the browser to save the file instead of opening it in the tab. The name of the downloaded resulting file can also be determined by the value of the attribute.
Key points
- Use <a> with the download attribute, not the regular form button.
- The value of the download attribute can determine the name of the resulting download file.
- The href attribute points to the location of the file to be downloaded.
- Include file format and file size details so that users know what is being downloaded.
- For cross-origin files, download behavior can be restricted by the browser.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.