...

View Full Version : Allowing a download but not following a link



brichcja
11-20-2010, 01:01 AM
Apologies for the title. I couldnt express myself in short.

Anyhow, what I want to do is make an anchor like this:

<a onlick="DoSomethingOrOther" href="location/tune.mp3">Text</a>

so that the user can click and DoSomethingOrOther, or right click and have the option to download "tune.mp3". However, the presence of the href means that when they click, they follow the link. If I take it away, they can't follow the link, but they also can't do the download.

Is there any way I can do this? Thanks!

Excavator
11-21-2010, 06:43 PM
Hello brichcja,
Have you seen a particular site that has the download behaviour you want?

The best I can suggest might be a target="new" so the download opens up in another window. There might be a js solution that opens up a small download box, try google for that.

Here's some options - http://www.goldcoastwebdesigns.com/create-download-link.shtml

brichcja
11-27-2010, 09:59 AM
Thanks for that. I solved it!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum