I'm not going to argue about why you shouldn't do this and not going to tell you how much everybody hates singing websites, so here is the code you have to put in the <head> section of your website. <embed src="LocationOfYourSong.wav" autostart="true" loop="false"> Code (markup): Good luck, mate.
I also suggest not mentioning how it's on every top-ten list of how not to build a website, or how it's more likely to make people navigate away from the page the second it starts playing since they can't be bothered to hunt for where to turn it off... assuming you even provide one.
Thank you for your reply.But a problem. When I use this code.A message show "a plug in is needed". How I solve this problem.Please help me.
Then your browser can't play MP3 / WAV / whatever file type it is, which I think it's a smart way for browser's developers to prevent this kind of practice. Joking aside, try this, hide it (#jquery_jplayer_1 {visibility: hidden;}) and set it on autoplay. This is kind of the only way it's guaranteed to work on most web browsers. Good luck.
Please be aware there is not much that makes users leave a web site faster than automatic background music. It's an enormous web design no-no. Good luck though!
I do not think putting a background music to a webpage is a good idea as well. It's pretty distracting for the users.
If you want to use background music for your website.Use this tag. <body> <p>HTML background music test</p> <embed src="bgsound.mp3" autostart="true"> </body>
You can also try to use the new HTML5 audio tag for this. <!DOCTYPE html><html> <body> <audio controls="controls"> <source src="song.ogg" type="audio/ogg" /> <source src="song.mp3" type="audio/mp3" /> Your browser does not support the audio element. </audio> </body> </html> Code (markup): Good Luck!
or you can just put a youtube video and put it on autoplay. This is better than the methods mentioned cuz most ppl have flash and you can also turn the music off.
I'm sure there are (probably) reasons to have music embedded on a webpage somewhere... I think. Anyway, let me assure you, these reasons, if they exist, are not numerous. AKA - please don't emded sound in a webpage.