...

View Full Version : How to add background music to my webpage



keerthy
01-05-2012, 07:50 AM
How to add an .mp3 file using java-script with HTML.

I wish to add an mp3 file as a background music to my webpage. It should load automatically while user viewing my home page.

I'm doing a project in php.

"Give me a simple and easiest guideline for me"

-thank you :)

Philip M
01-05-2012, 07:55 AM
Google is your friend! Adding music to a webpage is a cross-browser minefield, and if it is made to play automatically will probably annoy your visitors and drive them away. What if they are playing music already when they arrive at your site?

Have a look at

http://www.frontpagewebmaster.com/m-189647/tm.htm#189647

and take the advice offered!!

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

chump2877
01-05-2012, 08:18 AM
I agree with Phillip -- adding background music to your site is usually a terrible idea.

That said, the new HTML5 "audio" tag (http://www.w3schools.com/html5/html5_audio.asp) is another possibility.

Also check out: http://www.html5rocks.com/en/tutorials/webaudio/intro/

Philip M
01-05-2012, 08:39 AM
That said, the new HTML5 "audio" tag (http://www.w3schools.com/html5/html5_audio.asp) is another possibility.


Even that is a nightmare! The MP3 file format is supported by
Internet Explorer 9, Google Chrome 6 and Apple Safari 5, but NOT by
Firefox 4.0 or Opera 10.6 :(
Aaaarrrggghhh!

chump2877
01-05-2012, 09:00 AM
Well if you have to use audio (or video) in a site, that would appear to be the way to do it moving forward. The best way to fight cross-browser issues is to implement a standards-based approach.

keerthy
01-06-2012, 03:09 PM
thanks for your tips n guidelines :)

candi
12-20-2012, 04:58 AM
Hello,

I have background music on this website: beauty-4-ashes-outreach.org. I want to know if there is another code to use to have the music to play visiting the site from a cellphone and or tablet?

The code I had that didn't work was:
<object type="audio/mp3"
data=".mpg">
<param name="autoplay"
value="false">
</object>

Also, for it to be cross browsers.

She wants to have music on her site

Thanks in advance

Philip M
12-20-2012, 07:45 AM
Hello,

I have background music on this website: beauty-4-ashes-outreach.org. I want to know if there is another code to use to have the music to play visiting the site from a cellphone and or tablet?

The code I had that didn't work was:
<object type="audio/mp3"
data=".mpg">
<param name="autoplay"
value="false">
</object>

Also, for it to be cross browsers.

She wants to have music on her site

Thanks in advance

Please see the previous answers posted in this thread.
One more time - adding background music to your site is usually a terrible idea.
Especially for mobile devices.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum