Save as to appear instead of openning file in the browser....

M

Mel

i have files ready for download on my server. things like xxx.doc yyy.xls
etc.
i do not wish the browser to open them upon user click, instead i want to
present a "save as..." dialog to appear
how can i do that on my href(s) ?

thanks,
Mel
 
S

Steve Pugh

Mel said:
i have files ready for download on my server. things like xxx.doc yyy.xls
etc.
i do not wish the browser to open them upon user click, instead i want to
present a "save as..." dialog to appear
how can i do that on my href(s) ?

The user's browser will do whatever it has been configured to do with
those file types. There's nothing you can do in HTML to change that.
You can do a few things on the server (by playing with the
content-type and/or content-disposition http headers) but even so you
can't be sure of over riding the user's preferences.

http://www.htmlhelp.com/faq/html/all.html#force-download

Steve
 
J

Jan Harders

Mel said:
i have files ready for download on my server. things like xxx.doc
yyy.xls etc.
i do not wish the browser to open them upon user click, instead i
want to present a "save as..." dialog to appear
how can i do that on my href(s) ?

thanks,
Mel

You'll have to change the headers the server sends to the client when it
requests a pdf. Make it send something like:
Content-type: application/pdf
Content-Disposition: attachment; filename=mypdf.pdf;
 
B

brucie

in post: <
Mel said:
i do not wish the browser to open them upon user click, instead i want to
present a "save as..." dialog to appear

if you don't want that to happen then change *your* preferences. let the
visitor handle the file how they want to.
 
B

brucie

in post: <
Jan Harders said:
You'll have to change the headers the server sends to the client when it
requests a pdf. Make it send something like:

the OP doesn't need to do anything except stop trying to be a control
freak. let the visitor handle the file how they want to. if the OP whats
something different to happen with _their_ setup then they should change
_their_ setup.
Content-Disposition: attachment; ...

high security risk accepting content disposition headers. if you do you
get what you deserve.
 
J

Jan Harders

brucie said:
in post: <

the OP doesn't need to do anything except stop trying to be a control
freak. let the visitor handle the file how they want to. if the OP
whats something different to happen with _their_ setup then they
should change _their_ setup.

sure enough, but's it's a nice feature to have one link "open" and another
one "download" - especially when you got users that are total beginners -
telling them to rightclick somewhere and choose bla bla ain't too cool.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top