cancel
Showing results for 
Search instead for 
Did you mean: 

Opening download window

N/A

Opening download window

What is the technique for putting a link into a webpage that will automatically open the download window? Does this depend on the filetype? (The file I want to make downloadable is a tif image file.)

I have been looking at html source for various pages on the net trying to spot where the instruction is but most of the links just seem to have the location of the file in href. When I put the location of the file into the href clicking on it causes the file to open, rather than give me the option to choose where to save it.

Grateful for any help.
2 REPLIES
chino
Grafter
Posts: 446
Registered: 27-06-2007

Opening download window

As far as i am aware there is no set way you can force a file to be downloaded the link should be a normal hyperlink and if your browser (IE, Opera ect) cannot open it then it will ask you if you want to save it or open it. If you have a file such as a .mp3 where your browser knows which appliaction can open it then it will open it in that appliaction rather than ask you to save it. So really there are two ways to get around this:

1 Change the file name for an example song1.mp3 to song1.lala and then put a note on your website to inform EU (end users) to rename the file.

Or

2 Put a note on the website asking cusotmer rather than just clicking on the hyperlink to go right mouse click > File save as.

cUnDaLl

Ps Posted off duty..........
N/A

Opening download window

Quote
As far as i am aware there is no set way you can force a file to be downloaded...


There is a way, if you don't mind a bit of cgi. Instead of linking to the file, link to a php (for example) script which returns the file with a different content type - something like Application/Octet-Steam. Most browsers won't know what to do with the content type so will download it.