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

Discussion in 'HTML' started by Mel, Jul 17, 2004.

  1. Mel

    Mel Guest

    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
    Mel, Jul 17, 2004
    #1
    1. Advertising

  2. Mel

    Steve Pugh Guest

    "Mel" <> wrote:

    >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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Jul 17, 2004
    #2
    1. Advertising

  3. Mel

    Jan Harders Guest

    Mel <> typed:
    > 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;
    Jan Harders, Jul 17, 2004
    #3
  4. Mel

    brucie Guest

    in post: <news:5d8f7$40f93ff3$44a7759e$>
    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 r u c i e
    brucie, Jul 17, 2004
    #4
  5. Mel

    brucie Guest

    in post: <news:>
    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.

    --
    b r u c i e
    brucie, Jul 17, 2004
    #5
  6. Mel

    Jan Harders Guest

    brucie <> typed:
    > in post: <news:>
    > 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.


    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.
    Jan Harders, Jul 18, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DJ
    Replies:
    6
    Views:
    324
    John Harrison
    Oct 27, 2004
  2. Mel
    Replies:
    6
    Views:
    431
    Jonathan N. Little
    Sep 6, 2006
  3. Replies:
    1
    Views:
    278
    Alf P. Steinbach
    Apr 17, 2006
  4. Replies:
    2
    Views:
    263
    Alf P. Steinbach
    Apr 17, 2006
  5. ER
    Replies:
    2
    Views:
    492
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Aug 12, 2007
Loading...

Share This Page