Download PDF Files to Browser's Download Manager Rather than Window

Permalink 2 users found helpful
Hi Everyone

I've made a "Designer Content Block" which includes a download file option for a PDF document. When you click the download link on the live site, the browser opens it in the same window.

Is there a way to force the download to go to the browser's download manager, or at least open in a new window?

Cheers, Patrick

PatrickCassidy
 
adajad replied on at Permalink Best Answer Reply
adajad
Try adding the following to your .htaccess

<FilesMatch "\.(?i:pdf)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment
</FilesMatch>
PatrickCassidy replied on at Permalink Reply
PatrickCassidy
Beautiful work as always adajad! Just modified .htaccess as described and it has worked in both firefox and explorer - it is now opening up a "save" or "open" dialogue box, and the PDF's now open independently in Adobe Acrobat.
robertcrawford replied on at Permalink Reply
I had to try and fix so many things on 10 that i didn't have time to do anything else on the computer.
Steevb replied on at Permalink Reply
Steevb
Are you downloading from the file manager or external folder?

What OS and Browser are you using?
PatrickCassidy replied on at Permalink Reply
PatrickCassidy
PDF From the Concrete5 File Manager.

I'm running Windows7 64Bit and Latest version of Firefox.
My client is running Explorer (not sure what version sorry)

I haven't modified the .htaccess file yet, I've been a bit snowed under with another project, so I can't tell you if it works or not yet.

The only other solution I could think of was to ZIP the PDF up - it would have to download it through the browser's download manager then.
Steevb replied on at Permalink Reply
Steevb
Okay,
Just tried with W7 64bit and as you say both Firefox and IE open in the same window.

The way I do it is by placing all my pdf's in a folder called 'downloads' and then use a link to download. At least it opens a new window on windows.
joseajohnson replied on at Permalink Reply
joseajohnson
Possibly you can just alter the Designer Block, or make the following changes when you create a new pdf link block.

Goto your content and put the cursor in the link.

Your Block / WYSIWYG Editor / Insert/Edit Link / General Properties


Then, either change the Target of the link to:

Open in new window (_blank)


Or hit the 'Edit HTML Source' button and modify the link to contain

target="_blank"


That should make the link open in a new window.

Let me know if it works out -

Good Luck!
PatrickCassidy replied on at Permalink Reply
PatrickCassidy
Hi Josea

Thanks for your reply.

The designer content block contains a 'File Download' Field for the client to select a file only, not through a WYSIWYG Editor. This helps me to make it really simple for the client, and every Field is styled in CSS, so I can't use the method you have suggested.

adajad's .htaccess method above has done the trick though, for everyone's future reference.

Cheers!