HTML5 is the greatest version of HTML ever! (Well, at least until the next awesome version comes out). I just learned how trivially easy it is to force downloads with HTML5.
Forcing Downloads is Easy—HTML5 to the Rescue!
Not only is there a better way, but it’s trivially easy to implement. I just add the keyword
download to my anchor and BAM! the browser will pop a dialog box. I haven’t tested it in a lot of browsers (or devices), but it’s still huge! I mean, as a fallback I can attach a download function only to links that have the
download keyword in them.
Now my download links look like this:
<a href="link to file" download="">Download the PDF</a>
I’m practically crying, I love HTML5 so much!!!