admin管理员组

文章数量:1416050

I am really having some problems in that I want my visitors to open a certain PDF from a link on my site, however, I can get it to display on a separate tab next to my website, but what I would really like is for it to be forced to open in Adobe Reader. Is this possible? Has anyone managed to do this?

I have my links set up, they open in a separate tab, but I just feel its more professional if it were to open in Adobe Reader.

I am really having some problems in that I want my visitors to open a certain PDF from a link on my site, however, I can get it to display on a separate tab next to my website, but what I would really like is for it to be forced to open in Adobe Reader. Is this possible? Has anyone managed to do this?

I have my links set up, they open in a separate tab, but I just feel its more professional if it were to open in Adobe Reader.

Share Improve this question edited Jan 10, 2013 at 21:55 cimmanon 68.4k17 gold badges168 silver badges172 bronze badges asked Jan 10, 2013 at 21:47 PrimalScientistPrimalScientist 8616 gold badges18 silver badges27 bronze badges 5
  • 7 You can't control how a random puter opens a link clicked on your web site. Besides, if you did this, how would you handle somebody who doesn't have Adobe Reader installed? – Jeff S Commented Jan 10, 2013 at 21:51
  • Deciding which application to use for a specific file type is a function of the browser itself. You could send header information to indicate that the file should be downloaded rather than opened, but the browser controls anything beyond that. – cimmanon Commented Jan 10, 2013 at 21:54
  • Ahh, okay, thanks though. So, really the best way forward is that the user can just open the PDF in a new tab? Then they can just print and view I guess? Thanks for the reply there. Daz. – PrimalScientist Commented Jan 10, 2013 at 21:56
  • Is my above ment correct would you say? In that it can only be viewed in a separate tab? – PrimalScientist Commented Jan 10, 2013 at 22:05
  • As others have mentioned, you could have the user download the pdf when they click the link. The download dialog usually gives the user the option to either save the file to disk or open it. The user will always choose which program to open the file with. Forcing people to use Adobe is a bad idea... there are lots of people who don't have/want Adobe Reader on their puter (including me). – jahroy Commented Jan 10, 2013 at 23:07
Add a ment  | 

2 Answers 2

Reset to default 2

Ive been looking for the same thing, and the answer is very simple : add download to your a href code : < a href="document.pdf" download>

It prompts a box which asks you if you want to save or just open the document

Normally the browser will detect that the link with holds a .pdf, and it will open up the PDF in the browsers viewer, and I have seen this in just about all browsers. Then you will be able to use the given functions like size, print, and save.

本文标签: javascriptHow can I get my PDF to open in Adobe Reader by clicking a link in my websiteStack Overflow