Answers for "How to play a notification sound on websites?"

0

How to play a notification sound on websites?

function playSound(url) {
  const audio = new Audio(url);
  audio.play();
}

<button onclick="playSound('https://your-file.mp3');">Play</button>
Posted by: Guest on May-24-2021

Browse Popular Code Answers by Language