How to play a notification sound on websites?

前端 未结 11 1527
生来不讨喜
生来不讨喜 2020-11-28 01:32

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

11条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 02:14

    if you want calling event on the code The best way to do that is to create trigger because the browser will not respond if the user is not on the page

    
    

    now you can trigger your button when you want to play sound

    $('#playSoundBtn').trigger('click');
    

提交回复
热议问题