2

I'm working on my HTML and Javascript project and I wanted to add music for the website..

Is there any way I can put more than one song in the code to be played? And is there anyway that the song will continue when openning the next page?

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
shouq
  • 33
  • 2
  • 2
    Why are people voting to close this? Music on webpages is annoying, yes, but this is still a real question. – mpen May 10 '10 at 19:27

2 Answers2

3

Without using Flash, you are bound to a new HTML5 technique <audio/>, which is supported in Firefox 3.5+, Safari 4+, Chrome 3+, and Opera 10+. Here is an example:

<audio src="path/to/some/audio.file" autoplay>  
  This is a fall back for old browsers, here you could implement a Flash based audio player
</audio>  

I'm not sure if it is possible to continue the song when opening the next page, maybe you could store player data in a cookie.

Harmen
  • 22,092
  • 4
  • 54
  • 76
2

Here is a similar question with some good answers. The comments in that question list many duplicate questions as well. Many of those answers require HTML5. There are also various Flash-based answers as well.

If you want the song to continue when opening the next page you will need to use frames (easy) or make your website entirely AJAX-driven (more tedious).

Community
  • 1
  • 1
Trey Hunner
  • 10,975
  • 4
  • 55
  • 114