Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Location
    india
    Posts
    6
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Smile How to add background music to my webpage

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    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-.../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.
    Last edited by Philip M; 01-05-2012 at 09:09 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    keerthy (01-06-2012)

  • #3
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,846
    Thanks
    21
    Thanked 157 Times in 148 Posts
    I agree with Phillip -- adding background music to your site is usually a terrible idea.

    That said, the new HTML5 "audio" tag is another possibility.

    Also check out: http://www.html5rocks.com/en/tutorials/webaudio/intro/
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • Users who have thanked chump2877 for this post:

    keerthy (01-06-2012)

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    Quote Originally Posted by chump2877 View Post
    That said, the new HTML5 "audio" tag 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!

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • Users who have thanked Philip M for this post:

    keerthy (01-06-2012)

  • #5
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,846
    Thanks
    21
    Thanked 157 Times in 148 Posts
    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.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • Users who have thanked chump2877 for this post:

    keerthy (01-06-2012)

  • #6
    New to the CF scene
    Join Date
    Dec 2011
    Location
    india
    Posts
    6
    Thanks
    6
    Thanked 0 Times in 0 Posts
    thanks for your tips n guidelines

  • #7
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    background music

    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

  • #8
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    Quote Originally Posted by candi View Post
    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.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •