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
2 Answers
Reset to default 2Ive 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.
版权声明:本文标题:javascript - How can I get my PDF to open in Adobe Reader by clicking a link in my website? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745247489a2649623.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论