I found the following answer, but it does not seem to work in an HTML page:
console.log('\u0007');
How I trigger the "System Bell" in nodejs
Is there a way to ring the system bell from Javascript?
Chrome OSX
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The answer you linked to works for Node because Node’s
console.logwrites to the standard output of the process. It’s actually the system’s terminal emulator that sees theBELcharacter and makes a beep. (No different than if you put aBELin a file and rancaton that file.)Since browser script does not have access to standard output, you’re out of luck.
However, you could use the
<audio>tag to play a sound of your choice.