Download Dialog

Discussion in 'Javascript' started by JCO, Oct 15, 2005.

  1. JCO

    JCO Guest

    Does anybody have a Download Dialog written in JavaScripts? This is for a
    website. I've seen it done before.... where you click on what you want and
    the dialog comes up asking you if you want to save it. From what I can
    tell, the name of the file is passed as a parameter of the JavaScript.

    Below is an example of what somebody (who I don't know) has done:
    http://eteamz.active.com/tejanoswhite90girls/handouts/

    Thanks
    JCO, Oct 15, 2005
    #1
    1. Advertising

  2. JCO

    Randy Webb Guest

    JCO said the following on 10/14/2005 7:31 PM:
    > Does anybody have a Download Dialog written in JavaScripts? This is for a
    > website. I've seen it done before.... where you click on what you want and
    > the dialog comes up asking you if you want to save it. From what I can
    > tell, the name of the file is passed as a parameter of the JavaScript.
    >
    > Below is an example of what somebody (who I don't know) has done:
    > http://eteamz.active.com/tejanoswhite90girls/handouts/


    It has nothing to do with Javascript. It has to do with file types,
    browser settings, and server-settings. The only thing that *may* be
    passed as a "parameter of the Javascript" is the URL to the file but the
    download dialog is user-dependent more than anything else and you can
    not "force" it.

    If the user wants to download it, they can right click>Save target As
    (or other wordings).

    If the user wants to display it in the browser (and has it set up that
    way) then allow them.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Randy Webb, Oct 15, 2005
    #2
    1. Advertising

  3. JCO

    JCO Guest

    Right I understand that. But if it is a pdf, it depends on if they have a
    program that reads PDFs. If they don't, it will download otherwise it will
    open it. As the case for all file types. I want to force the dialog box
    regardless of the file type and regardless of the application they have
    installed. The example I showed (link) is downloading a document. I have
    "Word" installed, yet the dialog forces me to only download the file.

    Other options is have the files zipped.. then they will all download.
    Disadvantage is that I have some customers that don't know a thing about
    zipping. And I don't want them to download and .exe (extractable) file.

    I also want to learn how to do the dialog box for the sake of learning the
    JavaScript anyway.

    Thanks for your input.


    "Randy Webb" <> wrote in message
    news:...
    > JCO said the following on 10/14/2005 7:31 PM:
    > > Does anybody have a Download Dialog written in JavaScripts? This is for

    a
    > > website. I've seen it done before.... where you click on what you want

    and
    > > the dialog comes up asking you if you want to save it. From what I can
    > > tell, the name of the file is passed as a parameter of the JavaScript.
    > >
    > > Below is an example of what somebody (who I don't know) has done:
    > > http://eteamz.active.com/tejanoswhite90girls/handouts/

    >
    > It has nothing to do with Javascript. It has to do with file types,
    > browser settings, and server-settings. The only thing that *may* be
    > passed as a "parameter of the Javascript" is the URL to the file but the
    > download dialog is user-dependent more than anything else and you can
    > not "force" it.
    >
    > If the user wants to download it, they can right click>Save target As
    > (or other wordings).
    >
    > If the user wants to display it in the browser (and has it set up that
    > way) then allow them.
    >
    > --
    > Randy
    > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    JCO, Oct 17, 2005
    #3
  4. JCO

    Randy Webb Guest

    JCO said the following on 10/16/2005 11:06 PM:
    > Right I understand that. But if it is a pdf, it depends on if they have a
    > program that reads PDFs. If they don't, it will download otherwise it will
    > open it. As the case for all file types. I want to force the dialog box
    > regardless of the file type and regardless of the application they have
    > installed. The example I showed (link) is downloading a document. I have
    > "Word" installed, yet the dialog forces me to only download the file.


    That is precisely what I said. It depends on the user's settings. You
    have yours set to display Word documents in the browser, I do not.

    > Other options is have the files zipped.. then they will all download.
    > Disadvantage is that I have some customers that don't know a thing about
    > zipping. And I don't want them to download and .exe (extractable) file.


    Then educate your users.

    > I also want to learn how to do the dialog box for the sake of learning the
    > JavaScript anyway.


    There is no Javascript that can "force" that download dialog.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Answer:It destroys the order of the conversation
    Question: Why?
    Answer: Top-Posting.
    Question: Whats the most annoying thing on Usenet?
    Randy Webb, Oct 17, 2005
    #4
  5. JCO

    Evertjan. Guest

    Randy Webb wrote on 17 okt 2005 in comp.lang.javascript:
    > There is no Javascript that can "force" that download dialog.


    In fact there is.

    Serverside ASP-javascript can force a stream to be downloaded by:

    Response.AddHeader("Content-Disposition","attachment;filename=my.pdf");

    [I hope the above displays on one line]

    Content-Disposition RFC:
    <http://www.faqs.org/rfcs/rfc2183.html>

    Clientsided javascript cannot, I agree with Randy.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Oct 17, 2005
    #5
  6. JCO

    JCO Guest

    I hope I can write a JavaScript that is uploaded to the server (as my other
    scripts) that can invoke a download dialog (either the standard windows
    dialog or a user created dialog).

    "Evertjan." <> wrote in message
    news:Xns96F285EFE79F0eejj99@194.109.133.242...
    > Randy Webb wrote on 17 okt 2005 in comp.lang.javascript:
    > > There is no Javascript that can "force" that download dialog.

    >
    > In fact there is.
    >
    > Serverside ASP-javascript can force a stream to be downloaded by:
    >
    > Response.AddHeader("Content-Disposition","attachment;filename=my.pdf");
    >
    > [I hope the above displays on one line]
    >
    > Content-Disposition RFC:
    > <http://www.faqs.org/rfcs/rfc2183.html>
    >
    > Clientsided javascript cannot, I agree with Randy.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
    JCO, Oct 17, 2005
    #6
  7. JCO

    Evertjan. Guest

    JCO wrote on 17 okt 2005 in comp.lang.javascript:
    > "Evertjan." <> wrote in message
    >> Randy Webb wrote on 17 okt 2005 in comp.lang.javascript:
    >> > There is no Javascript that can "force" that download dialog.

    >>
    >> In fact there is.
    >> Serverside ASP-javascript can force a stream to be downloaded by:
    >> Response.AddHeader("Content-Disposition","attachment;filename=my.pdf")
    >> [I hope the above displays on one line]
    >> Content-Disposition RFC:
    >> <http://www.faqs.org/rfcs/rfc2183.html>
    >>
    >> Clientsided javascript cannot, I agree with Randy.


    [please do not toppost on usenet]

    > I hope I can write a JavaScript that is uploaded to the server (as my
    > other scripts) that can invoke a download dialog (either the standard
    > windows dialog or a user created dialog).


    Sorry, but serverside code [asp-javascript, asp-vbscript, php, etc] kan
    only work on the server and usually prepares and renders html content to be
    sent to the client, which can have clientside script code, like javascript
    [or also vbscript on the IE browser].

    The dialog surely must be on the client browser and the download also, be
    it that the with serverside code provided header code Content-Disposition
    can force the client to use it's own download popup window, instead of the
    usual stream that directly dislays pdf.




    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Oct 17, 2005
    #7
    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. Guest
    Replies:
    0
    Views:
    536
    Guest
    Jul 28, 2004
  2. Ken Cox [Microsoft MVP]

    Re: aspx and IE download dialog

    Ken Cox [Microsoft MVP], Aug 22, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    326
    Jerry III
    Aug 22, 2003
  3. timtos
    Replies:
    2
    Views:
    475
    timtos
    Oct 17, 2003
  4. yw
    Replies:
    3
    Views:
    807
    Phlip
    Jul 2, 2005
  5. Matt
    Replies:
    1
    Views:
    269
    Randy Webb
    Nov 20, 2004
Loading...

Share This Page