I'm relatively new to all this so go slow. But what I'm trying to do is have a button where the user can click it and download a file from my site to their computer. I don't know if you need a script to do this or if their is some form command that I'm missing, this is the current code that I have...

<input type="button" value="Download" onClick="document.location='myfile.pdf'">

Problem is when people click the "Download" button all that happens is the PDF is displayed, they can then save it manually if they want. However what I'm wanting it to do is when they click the button it offers them the option to "View or Save As". As I write this it does sound more like a script than form code, however I thought I'd check with the pro's before I begin my goose chase.

If a visitor to your site have pdf installed on their computer, or plugged into their browser, the browser will open the pdf file when you click on the link. The user then have a choice to "save" to their computer, or just "view" the file in the browser. Most users also know that if you right click on a downloadable link, they will have the option to "save as". Most other files, like mp3 or word doc files when you click the link, your browser automatically asks you if you want to "view" the file, or "save as". This function is a user enabled function, and depending on how the user to your website had set up their browser settings, will depend on if they can "save" something or first "view" something. The choice should remain to the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.