1

I am using HTML and CSS, and willing to use a very simple JavaScript code if necessary.

I uploaded ResumeWord.doc and ResumePDF.pdf to the FTP. I created links for "View" "Download" and "Print" for each. ResumeWord.doc only seems to give me a pop-up with options to Open or Save instead of opening in the browser, while I was able to open ResumePDF.pdf in the browser but not create a clickable link to download it without viewing. I have tried the HTML target_blank and JavaScript window.open for the "View", unsuccessfully. I am self-taught and an amatuer.

How can I make the "View" link open ResumeWord.pdf in the browser without a pop-up? How can I get ResumePDF.pdf to download when the user clicks "Download"?

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • You could use PHP to tell the browser to read the file instead of prompt the user to download. See here: http://stackoverflow.com/questions/4750252/open-pdf-in-browser-with-php – Liam Aug 22 '12 at 07:28

1 Answers1

2

Without some help, the browser won't assume that a user has Microsoft Word installed on their computer. That is why you only get the option to save it, rather than it opening.

The PDF, however, is something that can be viewed in-browser, and the browser can check if the right files are installed to make this happen. So if they are, the browser goes ahead and opens the file.

As for forcing the browser to open a word file, see this SO question.

And as for forcing a download of a PDF, see this SO question. It may not be possible, in your case, as the solution involves sending different server-side headers.

Community
  • 1
  • 1
Polyov
  • 2,281
  • 2
  • 26
  • 36
  • Hi SomekidwithHTML, thank you very much for answering my question. Unfortunately, the two links are identical. Do you have the other link for forcing the browser to open in a word file? Thanks! – Vanessa Pezzutti Aug 22 '12 at 18:21