Before you start, you should be aware that background music that automatically starts playing when a web page is loaded may not be appreciated by a large number of your visitors. Some of them, when greeted with the sudden blaring of music from their speakers, may immediately hit the BACK button of their browsers. This may occur even if you're playing a piece of music that you think is well loved by everyone: remember, there are people who surf the Internet in public libraries, at work, or in the dead of the night when others are asleep. Others may already have their favorite piece of music playing on their computer speakers, and your auto-playing music file will only cause them to be annoyed.
Even if you are satisfied that your website has the type of target audience that will enjoy your background music, there are alternatives to automatically playing music that you might want to consider. For example, giving visitors a link which they can click to play music would allow you to showcase your music while remaining sensitive to your visitors' preferences. Instructions on how to accomplish this, as well as how to implement autoplaying music, are given below.
<EMBED src="musicfile.wav" loop="false" autostart="true">
Replace musicfile.wav with the name of the music file you chose to upload to your web server. The code assumes you've saved the file in the website_root folder. If you save the file inside a folder on your root then you'd have to change the path slightly.
The autostart attribute tells the song file how to begin. If you have this set to "true", the song file will begin playing automatically when the page loads. If you put in "false", the sound file will not start automatically and the visitor will have to start the song by using their embedded media player.
The loop attribute tells the song how many times to play. If you have this set to "true" then it will play over and over again automatically. If you have it set to "false" it will play once and stop.
The hidden attribute tells the browser whether or not to hide the media player. It's not a good idea to leave this value at "true" unless you know for sure your visitors don't want to stop the music.
You don't want your music to annoy shoppers to the point they leave because they can't figure out how to turn the music off.