Skip to content

Basic example of using HTML5 download attribute to force non-downloadable file to download by the browser.

Notifications You must be signed in to change notification settings

0067/download-attribute

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tuts+ Tutorial: Quick Tip: Using the HTML5 “Download” Attribute

Instructor: Thoriq Firdaus

Creating a download link in HTML is straightforward; add an anchor tag and point to the file within the href attribute. Some file types, however, (such as images, .pdf, .txt, and .doc for example) won’t be downloaded. They, instead, will be opened in the browser.

If you have server-side access to your website there are some workarounds you can use, such as configuring the .htaccess, to download these files directly. If your site is hosted with a free service like WordPress.com, Blogspot, or perhaps Github pages which don’t allow you to do so, consider using the download attribute.

Source files for the Tuts+ tutorial: Quick Tip: Using the HTML5 “Download” Attribute

View the demo

About

Basic example of using HTML5 download attribute to force non-downloadable file to download by the browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.5%
  • CSS 41.1%
  • HTML 7.4%