473,761 Members | 5,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3091
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.javas cript 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******** ************@co mcast.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.javas cript 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.javas cript 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.javas cript:
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.AddHea der("Content-Disposition","a ttachment;filen ame=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******** ************@19 4.109.133.242.. .
Randy Webb wrote on 17 okt 2005 in comp.lang.javas cript:
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.AddHea der("Content-Disposition","a ttachment;filen ame=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.javas cript:
"Evertjan." <ex************ **@interxnl.net > wrote in message
Randy Webb wrote on 17 okt 2005 in comp.lang.javas cript:
> 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.AddHea der("Content-Disposition","a ttachment;filen ame=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
8539
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 all works fine. If the user selects "Open" or "Cancel", the window closes, which is the desired behavior. If they select "Save", the location dialog shows up, they save the file and the window remains open. I've tried a number of things to get...
0
1833
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 window. Well, thanks to Steve Orr, I have that working. However, I still have a few issues. First, the download dialog does not have the name of the file being downloaded in the "File name" field, instead it has the name of the aspx page that have...
7
2255
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, with a few exceptions: 1) IE displays the FIle Download dialog box twice. (You have to click the Open button twice) 2) the encoding of the page is set to Western European (Windows) versus UTF-8. #1 above is just a pain. #2 above results in...
4
1446
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, etc.. i click on next.. that download dialog box keeps coming up... why is that??? -- AdamPC@hotmail.com
2
1879
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 size, but would have thought that the Save As dialog would still come up fairly quickly and just the download time would take some time. I have tried to search for some example code for downloading files, but seem to only find examples on uploading...
4
2335
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 dialog boxes that says something like "Do you want to download FILEX.txt?" I want the user to be able to download the file rather than have the file displayed in the browser, because the file will include some characters such as tabs and commas....
2
1662
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 = MapPath(e.CommandArgument as string); // Name of file is passed in cmd arg.
1
1757
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 dialog know whether the user has clicked on the open button or the save button of the file download dialog??
1
47481
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.