How can I do that, so whenever a user clicks a link we play a sound? Using javascript and jquery here.
A:
First things first, i'd not like that as a user.
The best way to do is probably using a small flash applet that plays your sound in the background.
Also answered here: http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript
Javache
2009-01-16 10:45:49
What's so bad about it if the user knows a sound would be played?
lc
2009-01-16 10:48:59
+3
A:
Found something like that:
//javascript:
function playSound( url ){
document.getElementById("sound").innerHTML="<embed src='"+url+"' hidden=true autostart=true loop=false>";
}
Peter
2009-01-16 10:48:46
+4
A:
There seems to be a similar question, with anwsers for prototype, mootools, jquery and others: http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript
Tuxified
2009-01-16 10:50:09
A:
$('a').click(function(){
$('embed').remove();
$('body').append('<embed src="/path/to/your/sound.wav" autostart="true" hidden="true" loop="false">');
});
Andrew Philpott
2010-01-28 19:37:50