Reputation: 9679
how can I play a sound clip on page load?Is there any javascript or jquery to do that?I am creating my page in php.
Upvotes: 2
Views: 15127
Reputation: 1
The question was actually about how to do it in javascript.
var aClip = new Audio (path_to_file or URL);
aClip.play();
Upvotes: 0
Reputation: 15164
You can also combine the answers from premiso and CheeseConQueso with HTML5 audio tag: https://developer.mozilla.org/en/using_audio_and_video_in_firefox
Upvotes: 1
Reputation: 18863
Through simple HTML.
<object>
<param name="autostart" value="true">
<param name="src" value="sound.mp3">
<param name="autoplay" value="true">
<param name="controller" value="true">
<embed src="sound.mp3" controller="true" autoplay="true" autostart="True" type="audio/mp3" />
</object>
Upvotes: 3
Reputation: 6051
you can pull this off with straight html
http://www.webreference.com/js/column20/bgsound.html
or
http://www.htmlcodetutorial.com/sounds/_BGSOUND.html
I think wav, mid, and mp3 are supported
Upvotes: 1