Reputation: 21
I am currently running into an issue where I need to download pdf on anchor button click which is placed inside a bootstrap modal window.
Please help how this can be achieved. I tried using HTML5 "download" attribute but this does not work in IE and safari. and also clicking on this link in Firefox and chrome, does not download the pdf.
Many thanks in advance.
Upvotes: 0
Views: 262
Reputation: 735
The download attribute is not supported in IE, Safari or Opera version 12 (and earlier) So, check the browser version.
Upvotes: 1
Reputation: 491
There is way to force PDF files to be downloaded and not just opened in browser when you link to them. This way you wouldn't need to mess with HTML5 browser support.
All you have to do is to add this line in your .htaccess
file:
AddType application/octet-stream .pdf
Oh yeah, I forgot. On your button just add <a href="pdf location">button</a>
and that's it.
Upvotes: 1