There are three ways how to add music to your website or blog:
- Use the music as background.
- Use an embeded console which can play the music automatically.
- Use script from other website which provides this service.
Now, I want to show you how to do those ways. But I only test this in Windows based, not for Mac.
1. Use the music as background.
1.1 Background sound
This is a very simple step used for Internet Explorer (midi file only). Copy and paste this code to the HEADER between meta tag and stylesheet link. Change the myfile.mid with your music address.
<BGSOUND SRC=”myfile.mid” LOOP=”false”>
1.2 Background sound for mp3, wav, and au files
For other type of browser such as Mozilla or Opera (also IE), just copy and paste the code below. Change the myfile.mp3 with your music address.
<script language=”JavaScript” type=”text/javascript”>
if (navigator.appName == “Microsoft Internet Explorer”) {
document.write(’<bgsound src=”myfile.mp3″ LOOP=”false”>’);
}
else {
document.write(’<embed type=”application/x-mplayer2″ pluginspage=”http://www.microsoft.com/Windows/MediaPlayer/” Name=”MediaPlayer” src=”myfile.mp3″ AutoStart=”true” ShowStatusBar=”0″ ShowControls=”0″ ShowDisplay=”0″ volume=”1″ HEIGHT=”1″ WIDTH=”1″ loop=”false”><br>’);
}
// End –>
</script>
2. Use an embeded console which can play the music automatically.
2.1 Windows player console
Every computer using windows os will absolutely has windows media player. So, it’s the best way to add wmp console to your website. Just download and copy the java script file below.
Click to download the java script file for the Windows Media player.
Then copy and paste the code below tou your html. Don’t forget to change the address of your script_wmp.js.
<script language=”JavaScript” type=”text/javascript” src=”script_wmp.js”></script>
2.2 Quick time player console
To add a small Quicktime console, copy and paste the following code. Note that the computer should have quicktime installed.
<object classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” codebase=”http://www.apple.com/qtactivex/qtplugin.cab” height=”16″ width=”250″>
<param name=”src” value=”mysong.mp3″>
<param name=”autoplay” value=”true”>
<param name=”controller” value=”true”>
<embed height=”16″ width=”250″ src=”mysong.mp3″ pluginspage=”http://www.apple.com/quicktime/download/” type=”video/quicktime” controller=”true” autoplay=”true”>
</object>
2.3 Real Audio Player
Just copy and paste the code below to your website html.
<OBJECT ID=RVOCX CLASSID=”clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA” WIDTH=”350″ HEIGHT=”36″>
<PARAM NAME=”SRC” VALUE=”mysong.mp3″>
<PARAM NAME=”CONTROLS” VALUE=”ControlPanel”>
<PARAM NAME=”CONSOLE” VALUE=”one”>
<EMBED SRC=”your-file.mid” WIDTH=”350″ HEIGHT=”36″ NOJAVA=”true” CONTROLS=”ControlPanel” CONSOLE=”one”>
</OBJECT>
3. Use script from other website which provides this service.
You cand find many website in google which serves this. For example, you can visit codelagu.com. Just search your song, and get the code for your site.
Tags: add music, Add music to your website, Background sound, embed music


November 7th, 2009 at 1:02 am
You look great! So healthy and happy. How are you feeling? Sorry, I know this is about your sister’s music, but I just had to check in and see how you are doing.? Best to you.
February 7th, 2010 at 12:48 pm
Hi there, I spotted your blog via Yahoo and google while researching midi music downloads and your post caught my attention.