View Full Version : Force Download?

03-22-2007, 08:15 PM
Hi Folks,

I'm fairly new to the forum, a lurker for a while. I don't actually consider myself a web designer but did my former organization's website for 4 years (Dreamweaver). Since leaving I have been asked to do few sites and now feel the lack of training for code so I'm trying to catch up with taking as many tutorials as possible (its obvious Dreamweaver WYSIWIG experience isn't enough).

Question (finally). The site I'm maintaining for this artist has problems with inexperienced web users. I created for them a press page, so pictures and bios and be downloaded by concert presenters and the press (to save the management time). Now and then, they get someone who can't be bothered with reading instructions and are challenged by downloading via "right-click" or "option-shift-click" to get the needed pictures and word/pdf docs. They asked me (the management) if there is an easier way to download the pictures and documents so its automatic (one click download).

What I'm finding are browsers treat file formats differently. I have set the pictures and doc/pdf for linking to the file with "opening in a new browser". If you have told your browser to download word docs automatically, it will do that from the first time on (like Firefox) but a picture will pop up in a new window. This is of course if someone did not do a "option-shift-click" or "right-click". So if the user is not savvy enough to use "right-click" or "opt-shift-click" they are feeling lost.

Here is the link to the press page:

Possible solution is a force download (I'm not sure if that is the proper terminology?). I found a javascript on the net (no java experience unfortunately) to do a "force download" but you need to hide the url. It suggests replacing the file names with values (not sure how to do that yet). Here is the link:


Would this javascript be a good idea or am I looking at a nightmare? (Oh, and yes, the artist's server has php.) Anyone have experience or suggestions with "force downloads"?


03-22-2007, 08:31 PM
why dont you want to display the pics in the browser

03-22-2007, 08:37 PM
If you mean by the full sized pictures in the browser, it doesn't accomplish getting the picture itself downloaded if the user is familiar on how to put it on their computer for usage. Also the actual pictures are very large.

03-22-2007, 08:38 PM
sorry, I mean "user is unfamiliar on how to put the it..."

03-22-2007, 08:44 PM
if you mean large in dimensions then just control the size using HTML size attibutes in the <img tag

then once its loaded in the page you could instruct a user to right click and save as

03-22-2007, 08:55 PM
if you mean large in dimensions then just control the size using HTML size attibutes in the <img tag
Possible, but you leave the rendering to the browser, which sucks. Better will probably be to make a small image of your image, which you link to the large one with instruction to right-click.
<a href="large.jpg"><img src="small.jpg">Right click and choose 'save as' to save this photo</a>

03-22-2007, 09:10 PM
Thank you for the responses. I think maybe I'm being confusing because I'm not asking about how to do images on the html and thats not my question actually. I already display the images on the starting page at the size that makes them easy to view. The point is for the user to download the original files for press needs, DOWNLOAD to keep as a file being the goal.

The management claims some users are lazy or "computer challenged". They don't understand how to "right-click".

My question is to help the user download the image by doing a force download by just clicking on a link. I mentioned a javascript in my original email that mentions a possibility, but I'm not sure if its safe to use and or how to replace file names in java with a value.


03-22-2007, 09:14 PM
the only way i think you can do this is to zip the images and link to that

03-22-2007, 09:17 PM
There's definitely ways you can do this through some active-x trickery, but since I'm scripting challenged, I can't give code :-(
Even linking to a zipfile, might just open the zip software instead of prompting the download window

03-22-2007, 09:27 PM
zip files download

if you find a way to bypass how browsers interpret and handle files you will have to accomodate and detect which browser is accessing it and maybe come up with a hack for all browser types.

i think your fighting a loosing battle and i still think zip is the only way

03-22-2007, 09:39 PM
I can certainly try creating a zip file and link it to the file. I can put all the docs/pics into one zip and maybe also leave the option available for those that can "right-click" or "option-click" for individual files. (Sorry, just realized on the Mac "option-shift-click" is no longer required.)

I may look up java commands and see if I can figure out how to modify file names in place of a value. The javascript looks interesting for force download, but they don't have good instructions : (

Thanks guys for answering, very cool!