473,385 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Download Dialog

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
6 3067
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
0
by: Buddy Ackerman | last post by:
I am trying to implment a file download via a link such that when clicked, instead of starting the default application for that type of file the user will be presented with a download dialog...
7
by: Brian Paul | last post by:
When a user clicks on a linkbutton on a page, i would like to render a printer-friendly version of the asp.net page and download it as an html attachment to the browser. The code below works great,...
4
by: ACaunter | last post by:
Hi, when the download dialog box opens and i click save or open or cancel.. everything works fine.. but then it's stuck in memory or something, because nomatter what button, listbox, combobox,...
2
by: Grant | last post by:
Hi, I'm trying to download files using asp.net (vb) and it seems to take forever to actually bring up the Save As dialog box. The files are Academic Software Downloads so are quite large in...
4
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those...
2
by: Ken Varn | last post by:
I have an ASP.NET page that incorporates the following code on a button press. private void DownloadTag_Command(object sender, CommandEventArgs e) { FileStream fs; String Filename; Filename...
1
by: sunita | last post by:
Hiii I open a file download dialog from a modal dialog...From the file download dialog i can either save or open the file.. Is there a way i can let the modal dialog that opens the file download...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.