Prev: How can I dynamically populate data when selecting an option from a dropdown list?
Next: execCommand
From: Kevin Muenzler, WB5RUE on 28 Feb 2005 18:26 How do I force a browser to download a file instead of displaying it? In other words I have a page with MP3 and WMA files on it and I would like for the visitor to download the file instead of play it without having to right-click and save. How can I force the browser to pop up the "save file as" dialog box instead of playing it? I know that I can encapsulate it in a zip file which will download and open WinZip. Thanks Kevin -- Kevin Muenzler, WB5RUE 29ý14'52"N 98ý14'50"W Eagle Creek Observatory http://www.eaglecreekobservatory.org Eagles may soar, but weasels don't get sucked into jet engines. replace bitbucket by kevin in my email to respond. ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
From: Randy Webb on 28 Feb 2005 18:42 Kevin Muenzler, WB5RUE wrote: > How do I force a browser to download a file instead of displaying it? In > other words I have a page with MP3 and WMA files on it and I would like for > the visitor to download the file instead of play it without having to > right-click and save. You don't "force" anything on the web, you suggest: <a href="URLToMP3File.mp3">Right Click and choose Save As</a> > How can I force the browser to pop up the "save file as" dialog box instead > of playing it? I know that I can encapsulate it in a zip file which will > download and open WinZip. It does? Wow. I don't even have Winzip on my computer. If you can pull that one off, you will be a lot smarter than anybody I know. Again, you don't force anything, and definitely not a download window. Or give it your own made up extension that the browser won't have anything associated with. -- Randy comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
From: Kevin Muenzler, WB5RUE on 1 Mar 2005 12:46 You know Randy, I hope you don't run a helpdesk service. With a bedside manner like that you wouldn't last long. ;) If you don't have Winzip installed XP, and probably 2000, will download the file to the Temp area and launch Windows Explorer to display the contents. If you don't have a Wintel machine then all bets are off. As I'm sure you know...If the link is a known mime type <place browser name here> will either attempt to display it or launch the associated program after downloading it to the Temporary Internet Files area. If it's an application mime type a "Save As" dialog box will be displayed. If it's not a known mime type (file.xyz) the browser will attempt to figure out how to run it or display it. I have two file types, MP3 and WMA both are "known" mime types to WinX operating systems that are reasonably updated. If a person clicks on a link the file is downloaded to Temporary Internet Files and then played in the associated application. Media Player 9+ attempts to play the file as it's downloading. If the bit-rate of the file is higher than the download speed there's lots of pausing. This is annoying to some people. I would like to make it as simple as possible for the user to download the file without any fancy right-click/save target as. Especially since not every browser uses those terms. I would like for the user to just be able to click on the link to the file and have the browser ask him where he wants to save it. It can't be THAT difficult, eh? -- Kevin Muenzler, WB5RUE 29ý14'52"N 98ý14'50"W Eagle Creek Observatory http://www.eaglecreekobservatory.org Eagles may soar, but weasels don't get sucked into jet engines. "Randy Webb" <HikksNotAtHome(a)aol.com> wrote in message news:-MWdne95AbxzNr7fRVn-pw(a)comcast.com... > Kevin Muenzler, WB5RUE wrote: > > > How do I force a browser to download a file instead of displaying it? In > > other words I have a page with MP3 and WMA files on it and I would like for > > the visitor to download the file instead of play it without having to > > right-click and save. > > You don't "force" anything on the web, you suggest: > > <a href="URLToMP3File.mp3">Right Click and choose Save As</a> > > > How can I force the browser to pop up the "save file as" dialog box instead > > of playing it? I know that I can encapsulate it in a zip file which will > > download and open WinZip. > > It does? Wow. I don't even have Winzip on my computer. If you can pull > that one off, you will be a lot smarter than anybody I know. Again, you > don't force anything, and definitely not a download window. > > Or give it your own made up extension that the browser won't have > anything associated with. > > -- > Randy > comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
From: Randy Webb on 1 Mar 2005 18:40
Kevin Muenzler, WB5RUE wrote: > You know Randy, > I hope you don't run a helpdesk service. With a bedside manner like that > you wouldn't last long. ;) If you don't have Winzip installed XP, and > probably 2000, will download the file to the Temp area and launch Windows > Explorer to display the contents. If you don't have a Wintel machine then > all bets are off. I have WinXP SP2, no zip program, and it does nothing after clicking a ..zip file link other than asking me what program I might want to associate with it. As for the helpdesk, you and I both are glad I don't. But when I do download a .zip file, IE does nothing because I do not do most of my browsing with IE. > As I'm sure you know...If the link is a known mime type <place browser name > here> will either attempt to display it or launch the associated program > after downloading it to the Temporary Internet Files area. If it's an > application mime type a "Save As" dialog box will be displayed. If it's not > a known mime type (file.xyz) the browser will attempt to figure out how to > run it or display it. And whether the browser tries to run it or display it is directly related to two things: 1) The MIME type, which the site author has some control over (depending on server access). 2) User settings. Of which the site author has *no* control over. > I have two file types, MP3 and WMA both are "known" mime types to WinX > operating systems that are reasonably updated. REally? I just updated WinXP SP2 not a week ago and it still doesn't know what an MP3 is. But that is directly related to me telling it not to know what it is. > If a person clicks on a link the file is downloaded to Temporary Internet > Files and then played in the associated application. That depends directly on the browser involved, how the file is downloaded, and user settings. > Media Player 9+ attempts to play the file as it's downloading. That I honestly can't say anything about, never use MP. > If the bit-rate of the file is higher than the download speed there's > lots of pausing. This is annoying to some people. Yes, it can be. Stream it and the problem is solved and let the user's browser and settings handle it. > I would like to make it as simple as possible for the user to download > the file without any fancy right-click/save target as. That is as simple as it gets though. How would you propose to have a script force a download dialog if scripting is disabled? > Especially since not every browser uses those terms. > I would like for the user to just be able to click on > the link to the file and have the browser ask him where > he wants to save it. Make it a .zip file or some unknown MIME type and that will occur. I know of no browser that when presented with an unknown (to the browser) MIME type will attempt to open the file. > It can't be THAT difficult, eh? I gave you the simplest solution, it just seems that it was a solution that you didn't want to hear. Sometimes the simplest way is the best way. Please read this groups FAQ, via signature below, and it will enlighten you to a lot of good information. -- 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? |