I have some music in the background of my website (Let it snow.mp3) - using the following code:

<script language="JavaScript"><!--
if(navigator.appName=="Netscape"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" controls="SmallConsole" width=50 height=15></embed>');}
else if(navigator.appName=="Microsoft Internet Explorer"){
document.write('<embed src="let it snow.mp3" autostart="true" loop="true" width=70 height=25></embed>');}
else{
document.write('<embed src="let it snow.mp3" autostart="true" loop="true"></embed>');}
//-->
</script>
<noscript><embed src="let it snow.mp3" autostart="true" loop="true"></embed></noscript>
<noembed><bgsound src="let it snow.mp3" loop=true></noembed>

At the moment it starts playing automatically.

If the user is already listening to some music this can be annoying.

Would it be possible to have an alert box which comes up when the music is loaded saying something like:

Do you want to listen to "Let it Snow" by Chris Isaak while you browse my web site?
[Yes]        [No]

Hope you can help

Martin

Why not set autostart to false and set hidden to false? I THINK that would give some sort of musical icon they can click on to listen.

The only thing wrong with that is if they don't see the player.

Martin

I have a problem. on my website, a flash player plays a background sound but when I refresh it or i change the page, it stops like it is available only at that page. what can I do to hear that sound on multiple pages of my site? please help me

I have a problem. on my website, a flash player plays a background sound but when I refresh it or i change the page, it stops like it is available only at that page. what can I do to hear that sound on multiple pages of my site? please help me

Unless you make your entire site with flash, I think the only way to achieve this is to use frames - so your site pages run in one frame on a main page which just has that frame and your flash player on.

Hope this helps,
Martin

Thanks but I do not use frames because its ruining the design I think. Someone told me another way but VERY VERY COMPLICATED. To use a session in php or something like that to register the 'time of the song' when I change the page and to resume it on the other page in that session. Is anyone who tried this complicated method? I do not know how to control the sound like that.

Err... you could remember where the song is and restart it at the correct place on every page; but getting it syncronized properly over the Internet will be hell. It would take a long time to implement, a long time to test, and might not ever work without noticeable gaps or jumps in the song.

A frame is probably your best bet. I wouldn't worry about it 'runing the design', no1 need ever see the frames, and theres no reason you can't place a conformant W3C strict XHTML page inside a conformant W3C frameset XHTML frameset document. The only issue with frames is you lose the ability to use the address bar effectively.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.