How to Add Music to a Web Page
In this article you will learn several ways to add music to a webpage using html. Also you will learn how to have your webpage play music from a clicked link on your page.
Things You'll Need
- HTML (text) editing software (notepad, homesite, geocities)
- a mp3, midi, or wav music file on your site's server
Instructions
-
How to Add Music to a Web Page
-
1
If you already have the code to your web page, open it in notepad or another html editor.If you do not have the code, right-click on your page and click 'view source', copy and paste this code into notepad or other html editing software.
-
2
If you would like the music to be played when your page loads, place the following code:<embed src="MusicFileName.mp3" autostart="true" loop="true" width="2" height="0"></embed><noembed><bgsound src="MusicFileName.mp3" loop="infinite"></noembed>Specify the height and width of your music player.
-
-
3
If you would like the music to be played when a user clicks the link, use the following code: (*note: the user must have either windows media player, quicktime, or realplayer on their computer for the link to work)<a href="MusicFileName.mp3">Link Text Here, this is what the user will see.</a>
-
4
Save your html file with the .html file extension in the same folder as the music file.*** I recommend testing your page on your computer before uploading. ***Upload your music file to your web site's server.Upload your html file as well.
-
1
Tips & Warnings
*** Warning: A lot of people are easily annoyed by loud music that loads on their computer unexpectedly. If you want music on your page I HIGHLY recommend you add it in such a way that the user can turn it off if they choose.