Adding Music
How do I add music to my page?
So you want to add music to your page now. There are several different ways of doing it, however there are a few things you should keep in mind before adding music to your webpage.
- Using any audio file that contains the lyrics, such as .wav or .mp3 format is a copyright infringement, unless it is a direct creation of your own. This means putting up a song by your favorite artist is illegal and you could be sued for copyright infrigement.
- Music on your webpage, especially in mp3 or wav format drastically increases the page's loading time, taking forever on slower computers, and possibly crashing some users' browsers.
- Many people do not appreciate entering a website only to be assaulted with a song they haven't chosen to listen to, especially if they happen to already have music playing on their desktop. Just because you like that song does not mean everyone does.
- Give your users the option to turn the music on or off.
- If you must add music, stick to midi format, as it does not cross the boundary of copyright, not to mention takes much less time to load on someones page, and users who aren't running top of the line computers will thank you for this.
With all of that in mind, here are the codes to add music to your webpage.
Direct Linking to Audio Files
Use this code to direct link to an audio file. I prefer this code for adding music, since it gives the user the choice of whether they want to listen to the music or not. You can also choose to use an image link with this code, by using a normal image source code inside the link. See below for an example of how this code works.
Click here to listen to Nickelback!
<a href="URL OF MUSIC FILE">Click here!</a>
Embed Music Into Page
With this code, the music will begin when someone enters your page, and gives them the option to turn the music off by right clicking on the button provided.
Note: This code is only compatible with IE 4+ and Netscape 4+.
<embed src="URL OF MUSIC FILE" width=25 height=25 autostart=true repeat=true loop=true>
Embed Music Into Page #2
With this code, a small audio player will be embedded into the page, giving the user the option to turn the music on or off, like the player below this.
NOTE: If you don't see an audio player between this and the below code, it isn't compatible with your browser!
<audio id="NAME" src="URL OF FILE" controls preload="auto" autobuffer>