Download Dialog

J

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
 
R

Randy Webb

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.
 
J

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.
 
R

Randy Webb

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?
 
E

Evertjan.

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.
 
J

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. said:
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.
 
E

Evertjan.

JCO wrote on 17 okt 2005 in comp.lang.javascript:
Evertjan. said:
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.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top