Download link

D

David

Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer to save on their
hard drive as opposed to just being displaying in their browser?

E.g. to download word .doc files. I want them to be able to click on a link
on a webpage and a message to pop up saying do you want to download this
file and they can click yes and save it on their computer.


David
 
D

Dylan Parry

David said:
Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer to save on their
hard drive as opposed to just being displaying in their browser?

No. If the file is opening in the user's browser, it's because their
browser is able to support that file type, or has a plugin that does it.
The only way you have guarantee that the file will be downloaded, as
opposed to displayed, is to tell the user to right-click and choose
"save as" (or similar).

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
S

Steve Pugh

David said:
Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer to save on their
hard drive as opposed to just being displaying in their browser?

Use a normal link.
E.g. to download word .doc files. I want them to be able to click on a link
on a webpage and a message to pop up saying do you want to download this
file and they can click yes and save it on their computer.

<a href="whatever.doc">Whatever</a>

What happens when the user clicks on it is entirely up to how the user
has their browser configured.

Sometimes it will be saved automatically, sometimes it will be opened
in Word, sometimes it will be opened by a copy of Word running within
the browser, sometimes it cause the user to be asked what to do.

And then the user can always over ride their default setting by right
clicking on the link and selecting a different option from the context
menu.

Nothing you can do in HTML can force a particular behaviour. Which is a
good thing as the user probably knows better than you what his
requirements are, and also what his computer's capabilities are, at any
given time.

By configuring your server to send out certain HTTP headers along with
the file you can increase the chances that the user will be prompted to
decide what to do with the file. Thus putting an extra step in the way
of those users who have already configfured their systems correctly.

Steve
 
A

Andy Dingley

David said:
Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer

Why didn't you search for this question first?
 
S

Sid

: Is there any way with html to put in a link which clicking on will allow a
: visitor to my site to download a file to their computer to save on their
: hard drive as opposed to just being displaying in their browser?
:
: E.g. to download word .doc files. I want them to be able to click on a link
: on a webpage and a message to pop up saying do you want to download this
: file and they can click yes and save it on their computer.
:


The easiest way is to zip it. Even grannies now how to unzip these
days. Or make it a self-executable.

That way they are forced to download it, and not open/view it.

Sid
 
D

David

Steve and Dylan many thanks for your helpful explanations.
What you've said actually makes the problem simpler for me
because as I don't have any control there is nothing I can do
except ignore the issue and leave it to the user!
 
H

Harlan Messinger

David said:
Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer to save on their
hard drive as opposed to just being displaying in their browser?

E.g. to download word .doc files. I want them to be able to click on a link
on a webpage and a message to pop up saying do you want to download this
file and they can click yes and save it on their computer.

It's up to your users whether they want to save it to their hard drives
(in IE and Firefox, for example, by right-clicking the link and
selecting the option to save the link's destination). Certainly it can't
make any difference to you if they want to look at it in their browsers
and not save it.
 
H

Harlan Messinger

Sid said:
: Is there any way with html to put in a link which clicking on will allow a
: visitor to my site to download a file to their computer to save on their
: hard drive as opposed to just being displaying in their browser?
:
: E.g. to download word .doc files. I want them to be able to click on a link
: on a webpage and a message to pop up saying do you want to download this
: file and they can click yes and save it on their computer.

The easiest way is to zip it. Even grannies now how to unzip these
days. Or make it a self-executable.

That way they are forced to download it, and not open/view it.

Why would you make your users go through the trouble of saving a ZIP
file, extracting a Word file from it, and opening the Word file on their
machine, just to have a look at it?
 
C

cwdjrxyz

David said:
Is there any way with html to put in a link which clicking on will allow a
visitor to my site to download a file to their computer to save on their
hard drive as opposed to just being displaying in their browser?

E.g. to download word .doc files. I want them to be able to click on a link
on a webpage and a message to pop up saying do you want to download this
file and they can click yes and save it on their computer.

I use an anonymous ftp link for this sort of thing, especially if the
download contains a directory of several different types of files.
Using anonymous ftp avoids bothering the user with a password. On the
host I use, it is quite easy to set up anonymous ftp from the server
control panel. Some directories of media files can be rather
troublesome to download unless you use ftp.
 
S

Sid

On Fri, 24 Nov 2006 08:33:58 -0500, Harlan Messinger

: Sid wrote:
: >
: > : Is there any way with html to put in a link which clicking on will allow a
: > : visitor to my site to download a file to their computer to save on their
: > : hard drive as opposed to just being displaying in their browser?
: > :
: > : E.g. to download word .doc files. I want them to be able to click on a link
: > : on a webpage and a message to pop up saying do you want to download this
: > : file and they can click yes and save it on their computer.
: >
: > The easiest way is to zip it. Even grannies know how to unzip these
: > days. Or make it a self-executable.
: >
: > That way they are forced to download it, and not open/view it.
:
: Why would you make your users go through the trouble of saving a ZIP
: file, extracting a Word file from it, and opening the Word file on their
: machine, just to have a look at it?


Read the OP's requirements.

"...to download a file to their computer to save on their hard drive
as opposed to just being displaying in their browser?"

You didn't see that??

Sid
 
D

dorayme

Harlan Messinger said:
It's up to your users whether they want to save it to their hard drives
(in IE and Firefox, for example, by right-clicking the link and
selecting the option to save the link's destination). Certainly it can't
make any difference to you if they want to look at it in their browsers
and not save it.


Sometimes it can make a difference. There are circumstances where
nearly all the suggestions made in this thread are good. I won't
go into details because I have noticed no one takes the slightest
notice of anything I say. I am not complaining. I celebrate this.
I have worked hard to ensure it. And I congratulate myself.
 
N

Neredbojias

To further the education of mankind, dorayme
Sometimes it can make a difference. There are circumstances where
nearly all the suggestions made in this thread are good. I won't
go into details because I have noticed no one takes the slightest
notice of anything I say. I am not complaining. I celebrate this.
I have worked hard to ensure it. And I congratulate myself.

Maybe a lot of people actually notice but are too dumbfounded to comment...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top