Ask coding questions

← Back to all posts
How to add music to website with autoplay?
cic2 (9)

How to add music to website with autoplay?

Answered by PowerCoder (740) [earned 5 cycles]
View Answer
Comments
hotnewtop
PowerCoder (740)
<audio src="AUDIO_FILE_HERE" autoplay></audio>

Mark this as the correct answer if this helped :D

nameistaken666 (1)

Is there a way to loop it? or does it do it by itself?
@PowerCoder

PowerCoder (740)

@nameistaken666 To loop it, just add the "loop" attribute.

<audio src="AUDIO_FILE_HERE" autoplay loop></audio>
nameistaken666 (1)

@PowerCoder Im sorry for bothering you again but is there a specific file it works for, or is it any audio file?