How do I get my website to open a pdf outside of the visitors web browser?

JAFL

Baseband Member
Messages
24
I have a website with a link to a pdf. Currently, when a visitor clicks on the link, it opens the pdf inside the web browswer. I would like the the link instead to launch acrobat and open the pdf outside of their web browser.

Does anyone know how to fix this?
 
I think it all depends on the web browser. Someone else might know the way, but I don't think you can control those circumstances.
 
Assuming you are using Apache, you can put this in a htaccess file that is in the same folder as your PDF file...

So basically, save this:
Code:
<Files *.pdf>
  ForceType application/pdf
  Header set Content-Disposition attachment
</Files>

as ".htaccess", and upload it to the same folder as your PDF files.

It should do the trick, however under linux the extension is case sensitive, so you would need to use:

Code:
<Files *.PDF>
  ForceType application/pdf
  Header set Content-Disposition attachment
</Files>

if the extention was in uppercase..
 
Assuming you are using Apache, you can put this in a htaccess file that is in the same folder as your PDF file...

So basically, save this:
Code:
<Files *.pdf>
  ForceType application/pdf
  Header set Content-Disposition attachment
</Files>

as ".htaccess", and upload it to the same folder as your PDF files.

It should do the trick, however under linux the extension is case sensitive, so you would need to use:

Code:
<Files *.PDF>
  ForceType application/pdf
  Header set Content-Disposition attachment
</Files>

if the extention was in uppercase..


Honestly I'm really green when it comes to webdesign. I guess I have apache (how do I know?).

How do I save the code above? Do I copy and paste into wordpad and then save as a rtf file?
 
Honestly I'm really green when it comes to webdesign. I guess I have apache (how do I know?).

How do I save the code above? Do I copy and paste into wordpad and then save as a rtf file?

Copy it into notepad, and save it as ".htaccess" - INCLUDING the quotation marks.
 
Copy it into notepad, and save it as ".htaccess" - INCLUDING the quotation marks.

I'm not having any luck. I saved the file, uploaded to my host via the file manager into the same folder as the pdf, but it doesn't work when I click on the link at the site, it still opens the pdf in the browser.

Do I need to create a seperate folder that includes just the pdf and htaccess file? Also, I noticed when I upload the .htacess file that it doesn't even show up in the file manager.
 
It wont show up in the file manager because "dot files" are often hidden by default...

Just to confirm, you are spelling it ".htaccess" and not ".htacess" as you spelt it above?
 
j03: I'm not sure why I couldn't get your method to work, but someone suggested the same method to me on another board, but with a slightly different code and ht name, and it worked. So just thought I'd pass this along:

<Files *.pdf>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>


Then, the file name was just:

.htaccess (without any quotations marks on the ends).


It worked well. Anyway, I do appreciate your help.
 
Back
Top Bottom