Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Play mp3 on pageload

  1. Aug 13, 2008 #1


    User Avatar

    I have a website idea that I want to do to learn a little bit more about making web sites. One thing I don't know how to do, is I want the website to be able to randomly pick a sound file out of a directory, and play it on pageload. There will be a changing amount of sound files, so it wouldn't be good if I'd have to change a parameter of how many files there are every time. I don't know if I should be using php, or javascript, or something else. Can anybody help me?
  2. jcsd
  3. Aug 22, 2008 #2

    Ben Niehoff

    User Avatar
    Science Advisor
    Gold Member

    The easiest way I can think of would be PHP. You might be able to do AJAX (JavaScript), though. But PHP would be best.

    And for the love of all that is holy, please don't put auto-playing sounds on an actual production website.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook