By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Download Dialog

P: n/a
JCO
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
Oct 14 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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
Oct 15 '05 #2

P: n/a
JCO
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" <Hi************@aol.com> wrote in message
news:rv********************@comcast.com...
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

Oct 17 '05 #3

P: n/a
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?
Oct 17 '05 #4

P: n/a
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)

Oct 17 '05 #5

P: n/a
JCO
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." <ex**************@interxnl.net> wrote in message
news:Xn********************@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)

Oct 17 '05 #6

P: n/a
JCO wrote on 17 okt 2005 in comp.lang.javascript:
"Evertjan." <ex**************@interxnl.net> 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)

Oct 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.