Reputation: 807
I want to force a PDF to download, rather than load in-browser.
I'm using the following code in my .htaccess:
<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
It works great, except in Safari.
Any ideas?
Upvotes: 2
Views: 4784
Reputation: 20232
Try this in your .htaccess file
SetEnvIf Request_URI "\.pdf$" requested_pdf=pdf
Header add Content-Disposition "attachment" env=requested_pdf
It appears to work fine even with safari on my tests here
Upvotes: 12