Force browsers to download rather than display

On one of my websites, I’ve got some .gpx files that visitors can download. These are XML files that interface with GPS devices. The problem is that when a visitor clicks on the link to the file, it opens up as raw XML in the browser. That isn’t very helpful!

Is there any way to configure the server so that visitors who click on the link are prompted to download the .gpx file rather than opening it in the browser?

Depending on your server side language, there are code based solutions that can do this, rather than a server based solution.

Is that an option for you, or do you have 1000 links to modify, so a code based solution isn’t appropriate?

SD,

Is this YOUR server or are you sharing with others? If it’s yours, you should be able to remove the AddType statement for the .gpx files (from httpd.conf). If not, you could link to a download script which would have the same problem unless you zipped the .gpx. Is it worth all that?

Regards,

DK

Oops, have just realised that this site is one where I don’t have all that much control over the server settings, and certainly can’t change httpd.conf :blush: I forgot which site I was working on…

Thanks for your suggestions, but I think I might have to carry on with the current system of “hoping anyone using a GPS is smart enough to right click and choose ‘Download/Save target’”…

SD,

I have a client with a website which offers MP3 downloads to radio stations. The station owners who merely click on the link will get their (browser installed) MP3 player to download and play the file so I’ve “reminded” them to RIGHT CLICK to SaveAs immediately under the link. If they don’t bother to read that, then they deserve the problems they get by blindly clicking away!

Regards,

DK