Embedded sound should play continously in website

i hav website in which i embed the background sound…
i include header part which is common to whole site like

<?php include 'include/header1.php' ?>

in header1 i put this code to embed the sound -

 <div class="bg_sound">
<audio` src="images/bg_sound.mp3" controls autoplay="true" loop style="width:220px;" >	


	autostart="true" />


bt the problem is every time i change the page, i mean redirect to another tab…the the sound also reloded and paly from starting
i want the sound sould be play contineously in my site…

The only way I could think of to achieve this would be to update the page via Ajax. That way you avoid the page refresh which will reset the audio playback.


There are lots of solutions for this if you google it. Have you tried looking online for what’s available. There’s nothing new under the sun. Try something like “how to play music continuously” etc.

Old, but perhaps relevant:

Either that or an shudder iframe.

You mean two iframes? One with the site and the other with the player?

Or just one, right - the site content/“nav” in an iframe, the sound script playing out of the actual page?

The reverse doesn’t work, but ^ should?

Edit: Not that iframes are a good solution to much of anything, imo…

1 Like

If you provide a link to the file, the browser will open it in a player that is not tied to any site pages and will play until done / closed.

IMHO a much better approach than startling visitors (and their coworkers :smirk:) with unexpected sound.

1 Like

A lot of people consider it bad manners to play sounds on a website without the visitor’s permission. At least if you must play sound provide an off/mute option.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.