How do I add background music to a web page? So that when the visitor opens the page, the music will auto play.
I have tried <object> <embed> and <bgsound> but they are all not working in firefox. Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
<bgsound>tag is Internet Explorer-specific and will thus not work in other browsers such as FireFox. The<embed>tag should work in FireFox if you use it correctly. It will use a browser plug-in to play the sound. Below is an example:loop="true"specifies to play the sound repeatedly.src="sound.wav"specifies the relative path of the sound file to play. The variety of formats you can play depends on whattype=you specify.hidden="true"indicates to not show the media player’s interface. Hide it if you want the user to not be able to pause, stop, or navigate through the sound.type="video/quicktime"specifies to use a Quicktime component, which means the client must have Quicktime installed. Useapplication/x-mplayer2for Windows Media Player oraudio/x-pn-realaudio-pluginfor Real Player audio. Quicktime plays more formats and is probably what you will want to use.Alternatively, use
<object>in a very similar way. An example is below:Keep in mind that, like the
<marquee>tag, background sound on a web page is generally frowned upon because it is often obtrusive and annoying. Also, as the user switches between pages or causes post-backs, the sound will restart from the beginning. Only use audio formats that are highly compressed, meaning they have small file sizes, or the sound will not play for several seconds while it downloads to the client machine.