PDA

View Full Version : File downloads



rkstevens
03-22-2008, 08:39 PM
I want to force a file download when the user clicks on the link, and not have it open in the default program. I have an .mp3 download that I WANT as a download, and not played when clicked.
I want to try to idiot-proof the link for those that would not bother to read instructions such as "right-click and select 'saveAs'"

Can this be done?
Ron

incrediblehelp
03-23-2008, 12:51 PM
Yeah, but you should not do this as it forcing any sort of download can be construed as bad thing. If you want music to play when the user gets to a page, their are many other ways to do this.

rkstevens
03-23-2008, 04:02 PM
But here is my concern: The .mp3 is tied in with a special promotion that is going to be running on the site. I have a licence from the publisher to be able to give away a certain number of downloads. Therefore, I want the visitors when they get to the page to download the song. I do not want it to be played in the browser. I feel that if people are able to listen to the file in their browser, then they just may revisit the page several times to listen to the song, and use up my allotted number of free downloads unnecessairly. While I know someone could get multiple downloads, I think the liklihood of this happening is much less than if they were able to play the song in their browser. Also, I might be logging IP addresses to prevent multiple downloads (depending on the customer's wishes) and if someone just listens to the song when they wanted to download it, they would be upset when they are told they cannot access the file again. The target demographic is an older age, so I must assume that they would not understand about retrieving a file from their browser cache.
I just feel that forcing the e"Do you want to open this file, or save it" box so the user can control this choice, and then choose save to open the "Save as" dialogue box, over allowing the media player to play the file in the browser, is the best thing that I can do given the situation.

incrediblehelp
03-23-2008, 04:55 PM
Why not do the proper thing and create a page that convinces the users to download the song instead of trying to trick them into downloading it automatically?

rkstevens
03-26-2008, 07:58 AM
WWW FAQs: How do I force the browser to download a file to disk instead of playing or displaying it? (http://www.boutell.com/newfaq/creating/forcedownload.html)