.htaccess Force PDF Download in Safari
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)$">
ForceTyp开发者_开发知识库e application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
It works great, except in Safari.
Any ideas?
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
精彩评论