To play ambient background music on a Webflow homepage in a loop, autoplayed, you'll need to embed an audio element with specific attributes and ensure browser compatibility with muted autoplay and user interaction policies.
Go to your Webflow site’s Page Settings → Inside the Before
tag area.
Use the following inline element with standard HTML attributes. This example will loop the audio and play automatically (after user interaction):
<audio id="bg-music" src="YOUR_AUDIO_URL_HERE" loop></audio>
Then, add custom script to play after a user click (e.g., on the homepage):
``
This ensures the music will play after the first click anywhere on the page, complying with modern browser autoplay restrictions.
aria-hidden="true"
to your audio tag.controls
attribute.id="toggle-audio"
and use custom code to allow users to mute/unmute the audio.To loop and autoplay ambient background music in Webflow, embed an <audio>
element with loop
and load it via a script after a user interaction. This complies with modern browser requirements and keeps it fully within Webflow’s custom code capabilities.