If you code your web pages using a text editor (as opposed to using a visual web editor like Dreamweaver), you may be wondering how you might go about adding background music to your web pages. While this is not a question I encounter often at the sitewizard.com , I do get the occasional music aficionado sending me this query, hence this article.
Issues Surrounding Background Music
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 ("favorite" in US English) 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.
Playing Music Only When a Link is Clicked
If you have a music file (such as an MP3 file) that you want played when a visitor clicks a link, put HTML code like the following on your page:
<a href="yourmusicfile.mp3">Play music</a>
Replace the "yourmusicfile.mp3" with the appropriate filename. Note that the above HTML code works for ".wav" and ".mid" files as well (or anything else for that matter).







No comments:
Post a Comment