on-internet
← Community

Solve Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first

Stack Overflow ·

I tried to make html page with javascript to play sound on mouse over but when I tried the code on first reload on chrome browser it give me this error. How I can solve this issue in chrome. Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. <html> <head> <title>ضمور العضلات</title> <style> .img-container { text-align: center; } </style> <!-- Font Awesome --> </head> <audio id="musicSound" preload="auto" src="disability/sounds/song.mp3" > </audio> <audio id="hungrySound" preload="auto" src="disability/sounds/water.mp3" > </audio> <body s

Comments

Sign in or sign up to comment and upvote.

No comments yet.