Play Javascript / JQuery Sound

I am creating an Ajax-based application that will run on our local intranet.

  • Now, after each return request from my Ajax, I need to play the sound in the client browser.
  • I want to put the sound file (mp3 / wav) in the web server directory (Tomcat), where the application will be downloaded and play in the clientโ€™s browser. (I do not want to embed this and will just play automatically)

But I basically have this limitation.

  • Our intranet target computers do not have access to the external Internet, as this is blocked by our network team.
  • Most of the client is running Windows XP, and Flash cannot be updated or installed.

I know a bit of jQuery, but I donโ€™t know if what I think is possible and which possible plugin I can use is basically a cross browser. My target view works on IE6 / IE7 / IE8 / FF3.

+4
source share
2 answers

Without a flash and without a browser that supports HTML5 <audio> tags, this will be tough, if not impossible.

My first idea was to offer http://www.w3schools.com/html5/tag_audio.asp . Using

 <audio src="/sound/ajax.mp3" id="ajaxdone"/> // ajax success / readystate == 4 var mysound = $('#ajaxdone')[0]; mysound.play(); 

But it is also almost impossible in IE6 + 7 .

+3
source

In IE, you can use the tag <BGSOUND src= loop="1"> - add it and remove it before adding another.

I'm not sure which browsers accept this tag, and it's out of date.

0
source

All Articles