开发者

.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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜