Download, Don’t Open in Browser Window: Force Download

Download Dont Open in Browser

I recently created a PDF file with fillable form fields and wanted to post it on my site. The PDF file itself is terrific as you can fill in all the form fields and even submit it via a Submit Form button in the PDF file. Lovely.

Though when I see the link on the page in my web browser and click it, it launches my “browser” PDF reader which doesn’t have the ability to fill in form fields. In fact some ugly message comes up along the lines of “Your PDF contains fillable form fields which is not supported by this viewer.”

Yuck for two reasons. One, users can’t fill it in. And two, I don’t want some ugly warning message in the browser window confronting my visitors.

The solution isn’t using htaccess, java or anything even remotely nasty to force a browser download. In fact, with HTML5 it’s a ONE WORD solution.

All you have to do is add the word download to your <a> tag and if your browser supports it your visitor will get a Download Where? prompt.

Currently works in Firefox, Chrome and Android Chrome and Android Browser; source caniuse.com.

Here’s what the link will look like:
<a href="path/file.pdf" download title="Download PDF">Download</a>

Tags: , , ,

Leave a Reply

Other tags used in my blog:

 (1)  (6)  (1)  (16)  (1)  (1)  (17)  (1)  (16)  (1)  (1)  (7)  (1)  (4)  (15)  (5)  (2)  (27)  (9)  (1)  (11)  (4)  (4)  (4)  (8)  (1)  (6)  (1)  (4)  (1)  (1)  (1)  (3)  (1)  (3)  (4)  (7)  (2)  (3)  (4)  (1)  (1)  (2)  (1)  (7)  (9)  (11)  (2)  (6)  (1)  (3)  (16)  (2)  (3)  (1)  (5)  (1)  (26)  (4)  (4)  (9)