Sound when load page

Hi E's,
I need to load a sound (MP3) every time the page is load, and just play once and no repeat.
Have any easy way to do that, and without external library's?

The best regards,
JC
LVL 4
Pedro ChagasWebmasterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mukesh YadavFull Stack DeveloperCommented:
<audio autoplay="autoplay">
    <source src="path.mp3" type="audio/mp3">
</audio>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GixarCommented:
You can use the tag <audio> for HTML5 is easy to use and supported by all web browsers.

example:

<audio controls>
  <source src="sound.mp3" type="audio/mpeg">
</audio>

Also you can user <embed> tag is supported by almost all browsers, its load a  container for an external application or interactive content.

example :

<embed src="http://address/sound.mp3" loop="true" autoplay="true"> </embed>

I will choose the first over the second, because for IE, Safari and Chrome it works ok, but for FireFox  could ask for a plug-in to install.
Hans LangerCommented:
You could use javascript to play a sound:

<script>
window.onload = function(){
   var audio = new Audio('audiofile.mp3');
   audio.play();
}
</script>

Open in new window

Pedro ChagasWebmasterAuthor Commented:
Thank for all the answers, I will test all later in my office.
Just one thing, this solutions work in safari in iPad and iPhone's? If not, not worry, I will try to get that in other question!

Regards, JC
GixarCommented:
The <audio> tag from HTML5 should work without problem in Safari for Ipad o Iphone.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.