| Posted by: Guru
- [330592710] Wed, Apr 26, 2006, 16:58
In a web page, I'd like to embed an image icon which, when (left-)clicked, would open up a "Save As" dialog box, prompting the user to specify a filename & location for a target file to be saved.
What's the best way to do this? It would need to work in all typical browsers.
JavaScript?
Php?
Can anyone provide an example? |
| 1 | Guru
ID: 330592710 Wed, Apr 26, 2006, 17:00
|
I should add that when the icon is clicked to save the file, the page shown in the browser should remain undisturbed, so that when the save operation is complete, the original page is still active.
|
|
| 2 | Guru
ID: 330592710 Wed, Apr 26, 2006, 17:07
|
As further background, the target file will be an mp3 file, so creating a simple [a href=filename] link will simply load the mp3 file in the browser.
What I want to do is set up a process with a result similar to right-clicking on a filename. This is for a page of mp3 files that I want neophytes to easily download insteading of playing them in the browser.
|
|
| |
| 4 | Astade
ID: 293552522 Wed, Apr 26, 2006, 18:11
|
Guru,
I suggest Jscript. In your tag add an onclick event using the execCommand control.
More information
|
|
| 6 | youngroman
ID: 50818914 Wed, Apr 26, 2006, 18:40
|
I think 4 will only work in IE and not in other browsers like Firefox, Opera or Safari.
|
|
| 7 | Astade
ID: 293552522 Wed, Apr 26, 2006, 19:51
|
I didn't read post #2. My initial post only works for webpages really. YR also brings up a good point that it is only supported in IE.
I looked at post #3. That looks like a good bet. Server-side coding is the only way to do this. "Content-Disposition" is the key.
|
|
| 8 | Trip
ID: 72553010 Wed, Apr 26, 2006, 23:44
|
#6... That would probably take care of the problem as I would figure other users weren't neophytes.
|
|
| 9 | Guru
ID: 330592710 Thu, Apr 27, 2006, 12:27
|
Went with the PHP solution. I don't think you can assume that people using FireFox or Safari aren't neophytes. My Mom uses Safari, and she has no idea what she's doing - nor does she typically try something different if the first click doesn't produce the desired result. She'll often just give up and assume it doesn't work in her browser.
|
|
|