Moto G6 Play Review: First Look
I want the user to be able to download a pdf file by simply left-clicking a link rather than the more involved right click and "save target as".
<p><a target="_blank" href="click here">
ignore my comments
is not to right click and 'save target as'.
The link to the PDF will automatically download the file to the visitor's machine on a left click - provided he/she has the Acrobat reader installed. The normal procedure would then be for the person to save the file on their drive in the normal way - if he/she wanted to.
It doesn't matter what you do, the file can only be opened in the PDF reader anyway, and I can see no point in trying to make it more complex than that, and you certainly don't need to involve Java script. Just put the PDF file on the server (it's a good idea to keep it in a separate PDF directory) and then hyperlink to it in your HTML page in the normal way. The visitor's browser will do the rest.
It helps to provide a separate link to the Adobe site as well - so that people who may not have the Acrobat reader can download it before attempting to retrieve your file. Use a text link:
"You will need to have Adobe Acrobat reader installed on your machine before you can view this file. If you don't have the reader you can download the latest version HERE"
Make "HERE" a hyperlink to Adobe.com
I had problems like this before. When users left-clicked on a large PDF file, they just got a blank white page while IE did its stuff. If they waited five minutes or so for the large file to download it viewed OK via the browser plugin.
I put a note on my site to "Right-click and Save target as..." to overcome this problem: click here
However, since I update my own system to Adobe Reader 6.0, I get an error message as above. I expect that when I installed the reader I chose not to open PDFs in the browser as that is the way I prefer to work.
Madboy's solution is a good way around it but it involves the extra step of unzipping the file.
Opera is more configurable than IE.
Download to default directory without asking
Open in browser
Open in Adobe Reader (default application, or another application)
Show dialogue box
These can be configured differently on left-click for any file type - PDF MP3 ZIP DOC etc.
Good description of the general case - thanks. That is more or less what I do for most of my downloads, but there are times when the user won't be viewing the document in the browser there and then, but is saving it for later (eg a very large reference document).
What I was looking for was a method to immediately invoke download to disk on left click rather than view in browser, so it would bring up the normal download box straight away rather than wait for a long time while the download into the browser completes. Recognise that the overall process won't be any quicker, but feedback to the user is better.
This thread is now locked and can not be replied to.