How to get a link to pop up as Save As?

The way I would do it would have to make your target a direct link to a file (assumption is its Winrar).
 
Can you give an example on your site where this is not happening?

Usually it's either the result of an incorrect mime-type being sent (web server configuration) or you wanting to pop up a save box for a filetype the browser handles internally (like an image), in which case you can use the content-disposition header.
 
He wants to have mp3 downloads automatically pop up the dialog. I was thinking "target = "_blank" but my html sucks bad.


The work needs to be on this page: http://protias.com/services_2009_august.htm He needs the pop up dialog on all browsers and all OS's even if their preference is to open a default player automatically.
 
Last edited:
Can you give an example on your site where this is not happening?

Usually it's either the result of an incorrect mime-type being sent (web server configuration) or you wanting to pop up a save box for a filetype the browser handles internally (like an image), in which case you can use the content-disposition header.

Like here, http://protias.com/services_2009_august.htm

I'm talking with V3, and he had me change the html code for the last church service to use

<a href="http://protias.com/2009/Services/Service%20-%2008-30-2009%20-%2013th%20Sunday%20After%20Pentecost.mp3" target = "_blank">August 30, 2009 - 13th Sunday After Pentecost</a></p>

For some reason in Firefox, it plays in a browser and I want the dialog box for "Run, Save As, Cancel" to come up.
 
There are a few ways to do it. The best is to have the server send the Content-Disposition header (Content-Disposition: attachment; filename=file.mp3), but this requires some server-side programming or reconfiguration. Another way is to set a bogus Content-Type for the file, like application/octet-stream, the the browser knows it can't handle internally and will present a save dialog. IIRC IE basically ignores the content-type header though, so that might not work out. FF will only play MP3s if you have a suitable plugin installed. Usually that's Quicktime, though the VLC plugin will also play them.

Finally there are some ugly javascript techniques.

Don't do the target=blank thing. It's an old IE hack that just opens superfluous windows on basically any other browser, and that's annoying.

If you can't do any of this, I would just advise users to right click and save... it's a basic browser feature most people should be familiar with anyway.
 
if you can't or don't want to use the content-disposition header but can use .htaccess files you might be able to put all the files you want to force the save-as dialog to show in a folder and create a .htaccess file like
Code:
AddType application/octet-stream mp3 pdf doc <any other extensions>
however using php or similar to send the content-dispotion header would be much more reliable.
 
As of this time, I am just using FrontPage to make my site.

So I would have to do .htaccess for each one of my folders and put that code in the .htaccess file?
 
to be clear, .htaccess only works if your host uses apache and is configured to allow you to use .htaccess. you will have to find out about this yourself. .htaccess applies to the current directory and all sub-directories so you don't need to put one in each child directory if there is one in the parent.
 
to be clear, .htaccess only works if your host uses apache and is configured to allow you to use .htaccess. you will have to find out about this yourself. .htaccess applies to the current directory and all sub-directories so you don't need to put one in each child directory if there is one in the parent.

My hosting provider does allow .htaccess.
 
his argument about the "right click save as" are mac users. lol

Some of them are unfortunately. Why can't people just use pcs? :(

I probably should take a web design class eventually.

I haven't worked with Macs over the past few years, but why not just tell the people to use the right-click-equivalent option? It's either:

1) Hold down their click until the menu pops up; or
2) Hold Ctrl then click

Then they can get the options they want, one of which is likely "Save Target As...".

2.png
 
I haven't worked with Macs over the past few years, but why not just tell the people to use the right-click-equivalent option? It's either:

1) Hold down their click until the menu pops up; or
2) Hold Ctrl then click

Then they can get the options they want, one of which is likely "Save Target As...".

2.png

Well, the other thing is, this happens with in Firefox too. I just want to make this easy for everyone without having to put different "rules" on my main page on how to download.
 
There are a few ways to do it. The best is to have the server send the Content-Disposition header (Content-Disposition: attachment; filename=file.mp3), but this requires some server-side programming or reconfiguration.

This is the way to go. A little PHP-wrapper to send out the files will do the trick.
 
Well, the other thing is, this happens with in Firefox too. I just want to make this easy for everyone without having to put different "rules" on my main page on how to download.

So use the same rules every time: "Ctrl-Click and select 'Save As...' to save a file on this webpage."

See how I did that? Takes about 10 minutes to carefully word an E-Mail explaining this, or 20-30 minutes if you want to take some step-by-step screenshots. Takes care of the issue and right-clicking works in Firefox as well, so what's the problem with fixing the user rather than spending a day or two fixing the "problem" (which isn't actually a problem so much as it's a function of the browser?)
 
So use the same rules every time: "Ctrl-Click and select 'Save As...' to save a file on this webpage."

See how I did that? Takes about 10 minutes to carefully word an E-Mail explaining this, or 20-30 minutes if you want to take some step-by-step screenshots. Takes care of the issue and right-clicking works in Firefox as well, so what's the problem with fixing the user rather than spending a day or two fixing the "problem" (which isn't actually a problem so much as it's a function of the browser?)

Ah ok, gotcha. I will do this when I get home.
 
Well, if you have an agreement with the customer that states they should only have to click to do this, then you're kinda' stuck. I would hope you wouldn't have such a specific agreement for specific types of delivery on a per-file-type basis, that would be painful!
 
Well, if you have an agreement with the customer that states they should only have to click to do this, then you're kinda' stuck. I would hope you wouldn't have such a specific agreement for specific types of delivery on a per-file-type basis, that would be painful!

Nope, it is my own site and permission from my church to distributed all content freely. I am just trying to make it simple for everyone. My site is hosted by 1and1 so I am not able to make changes on the server as don't own the server, I just lease space on it.

Edit: Tried the Ctrl+Click and it opens in a new browser instead of a download dialog box.
 
His site is hosted using apache.

I think the htaaccess is going to be the trick.
 
if you can't or don't want to use the content-disposition header but can use .htaccess files you might be able to put all the files you want to force the save-as dialog to show in a folder and create a .htaccess file like
Code:
AddType application/octet-stream mp3 pdf doc <any other extensions>
however using php or similar to send the content-dispotion header would be much more reliable.

Thank you tim! I <3 you long time. :p
 
Back
Top