When a certain event occurs, I want my website to play a short notification sound to the user.
The sound should not auto-start (instantly) when the
function playSound(url) {
const audio = new Audio(url);
audio.play();
}
Edge 12+, Firefox 20+, Internet Explorer 9+, Opera 15+, Safari 4+, Chrome
Just use MP3
(for legacy browsers)
function playSound(filename){
var mp3Source = '';
var oggSource = '';
var embedSource = '