treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Save link as when left clicked

  • Is there any way to create an anchor link that when it is left clicked, the save as dialog box comes up for the target file (targetfile.mp3 for example)?
    It seems like it should be able to be done with javascript (even though it could be a security vulnerability to users), but I cant figure out how. I am no javascript guru and I cant for figure it out, even with lots of searching on the net.

    Any ideas?
  • The easiest way would just to put it in a zip file and make it available for download, but if you really need this functionality you can get it done with apache, depending on how familiar you are with it. Rather than re-hashing all the info, I'm going to point you here: http://www.dynamicdrive.com/forums/arch ... t-909.html. It looks like they have some good advice, especially this for apache:

    <Files *.doc>
    ForceType application/octet-stream
    </Files>
  • Thanks. I had thought about the zip file thing also. Unfortunately this is for a dynamic sites podcasting feature (Drupal). So in order to do that, and have a listen online function, I would have to have both the zip file and the .mp3 attached to each episode. Which wouldn't be hard, but it probably wouldn't be the best work flow. Thanks for the link, I will check it out.