+ 30
[SOLVED] Can I play background music with confirm() in js?
When I try it normally it gives an error that play() function can only be initiated by user gesture... But I did kind of the same thing in this code of mine... but with swal alert https://code.sololearn.com/W153Wjsx8oFM/?ref=app
14 Respuestas
+ 19
From What I've seen, confirm is not counted as a user gesture. You need an event (touchstart,click etc) for that. Swal alert is actually an HTML element which you are clicking (user gesture).
+ 11
Aravind maybe...
+ 11
Yes Atul🦚 bhaiya ... actually not feeling like creating a whole custom alert all by myself 😂🤣
+ 10
Bartika🎶 just create one in no time hardly take 1 hour and use in every code it will be ur signature alert too :)
+ 8
+ 8
Bartika🎶 u can make custom alert with js :D
https://code.sololearn.com/WOaWO5tHdv8o/?ref=app
confirm , alert aren't user gesture and Android don't allow autoplay of DOM elements
+ 8
Atul🦚 1 hour !!!!! 😱
+ 7
Bartika🎶 Or.. You can just use Atul's confirm into ur code, 😂
+ 7
Thnx Sick L̲̅i̲̅n̲̅e̲̅ B̶r̶o̶🌡️ [TheBloodCoders] !!!! 👍
+ 6
Same error occured in my game, I guess it's sl issue! Isn't it?
+ 2
Kode Krasher i agree with you but the whole point is autoplay here and that's not a " browser " issue its actually a "feature" of google ie android
You can autoplay in Ios with some simple hacks but in android its not possible
"""
https://developers.google.com/web/updates/2016/07/autoplay
"""
You could read this
And yeah i know about raw and dl i just wanted to demonstrate that custom alert thanks 😊 for pointing that out
+ 2
Yes you can
+ 1
Good
- 3
ℍ𝕠𝕨 𝕔𝕒𝕟 𝕚 𝕞𝕒𝕜𝕖 𝕥𝕙𝕚𝕤 𝕗𝕠𝕣𝕞 𝕥𝕠 𝕥𝕣𝕒𝕟𝕤𝕗𝕖𝕣 𝕕𝕖𝕥𝕒𝕚𝕝𝕤 𝕥𝕠 𝕞𝕪 𝕘𝕞𝕒𝕚𝕝 𝕒𝕔𝕔𝕠𝕦𝕟𝕥..
https://code.sololearn.com/W4TeM9l6Oqi8/
Uzodimma Joseph Ifeanyi Ask by creating a new question. Do not hijack existing threads.