My last post discuss on how to change the favicon of you blogger site
The default behavior of all browsers when dealing PDF files is opening it in a new tab / self and allow user to view the files. This action is best for small PDF and for some that has a powerful machine. But it doesn’t seem better when dealing a huge PDF files which result in droop your site or lock up the browser.
As I research in internet to find some suitable solution, I found these finest tricks to do this. – by adding the following code into your httaccess file.
The code will match perfectly for both lower case and upper case PDF extension by using regular expression and OR operator in the following line.
And that it… You have now the control in Forcing PDF to download.
The default behavior of all browsers when dealing PDF files is opening it in a new tab / self and allow user to view the files. This action is best for small PDF and for some that has a powerful machine. But it doesn’t seem better when dealing a huge PDF files which result in droop your site or lock up the browser.
As I research in internet to find some suitable solution, I found these finest tricks to do this. – by adding the following code into your httaccess file.
FilesMatch "\.(pdf|PDF)" ForceType application/pdf Header set Content-Disposition attachment </FilesMatch>
The code will match perfectly for both lower case and upper case PDF extension by using regular expression and OR operator in the following line.
<FilesMatch "\.(pdf|PDF)">
And that it… You have now the control in Forcing PDF to download.
6 comments:
You're amazing. Thanks. I looked for how to figure this out and ... well, this works seamlessly. And I can take the taget="_blank" off now as well! Hooray!
Thank you for your compliments. Yes you can now kick off that target ="_blank" code.
it's showing Internal Server Error ... anyone help..?
it' showing Internal Server Error.. anyone help?
Internal server error for me, too, looking for an other solution.
I figured out the internal server error: with this code, it works, no internal server error:
ForceType application/octet-stream
Header set Content-Disposition attachment
Post a Comment