Linking to audio files for direct download

R

robertalbrecht

I know I am missing SOMETHING, but I want to create a link to an audio
file that will NOT automatically play just because the browser supports
a plug in that can play the file, when clicked on i would like the link
to pop up a window that asks the person where he / she would like it
to be downloaded to.... what am i missing?
 
N

Nicholas Savalas - http://savalas.tv

Dear Robert,
There is many ways to force a download dialog prompt, but here is a
very simple method:
----------------------------
<html>
<body>
<script>
function forcedownload(x){
myDownloadWindow =
window.open(x,'','left=10000,screenX=10000');
myDownloadWindow.document.execCommand('SaveAs','null',x);
myDownloadWindow.close();
}
</script>
<a href=javascript:forcedownload("whatever.mp3");>Download this
song</a>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top