Forum Moderators: phranque
Now that I've made that clear, I'm currently working on one page where an automatic background sound will be downright desirable to me and to the visitors. I'm going to ask you to trust me on that; I'm fully aware of going against one of the cardinal rules of good web design but I have my reasons and have made my decision accordingly! ;)
So anyway, what is currently regarded as the best method of using a background sound that automatically starts and does not loop when the webpage is loaded? CSS? bgsound attribute? Having never done this before, I'm not exactly sure what the implications of each method may be. Therefore any advice is appreciated.
Unless of course the advice is to not do it at all - I've considered the pros and the cons and my decision is made! ;)
Thanks,
Matthew
You could autoload a player set to autoplay the music once.... either RealPlayer or another media player - problem with that is that some people wouldn't have the right one, and some folks (like me) disable all the players on their machines....
I think the bgsound element/attribute is deprecated? Not sure about that, haven't done sounds for about 10 years. I absolutely have no clue if there's a CSS way to do this.
Gee, I'm just no help at all. Sorry! Oh, hey - here's a thought: find a site that does this, view source and see HOW they did it....
<embed src="music.mid" width="1" height="1" autostart="true" loop="true">
<noembed><bgsound src="music.mid" autostart="true" loop="infinite"></noembed> It won't validate in a million years, of course - if that is critical, you should look for a Javascript solution.
You'll need to test this in a few modern browsers, though, to see what happens - I don't know how Mozilla/Firefox handles
bgsound for example. If bgsound is supported there, then you may decide to not bother with the embed.
EDITED: nope, that only works in IE ...sorry
Here you go htmlcodetutorial.com/sounds/sounds_famsupp_18.html