HTML5 Download Attribute
There are a couple of neat features in HTML5 that you should consider using more and more.
One of these is the download attribute, this allows you to set a separate file download name than the actual link endpoint, it is very useful if the file is e.g. dynamically generated and has some un-friendly names.
<!-- Download as "vacationPictures.zip" -->
<a href="/files/adlafjlxjewfasd89asd8f.zip" download="vacationPictures.zip">Download your pictures here</a>
You don't want your user to download something like t3784tg7834t7.zip, don't you?
Ah, the download attribute also forces the browser to download the linked file, this is particularly useful when dealing with pdf files as the common mistake is to serve links to those kind of files, requiring the browser to hang on while downloading the whole file in the background.
Written by Jacopo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Download
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#