Play Sound Javascript/Jquery
I am building an Ajax Based application that will run on our local intranet network.
- Now upon every return of request from my Ajax, I need to play a sound in my client browser.
- I want to put a sound file (mp3/wav) in my web server (Tomcat) directory where the application will download and play at the client browser. (I dont want to embed this and will just automatically play)
But I basically have this limitation.
- Our 开发者_如何转开发target users intranet computers has no access to the outside internet since this is being block by our network team.
- Most of the client runs on Windows XP and Flash might not be updated or not being installed.
I know a little jQuery but I dont know if what I am thinking is possible and what possible plugin can I use that is basically cross browser. My target browse runs on IE6/IE7/IE8/FF3.
Without flash and without a browser that supports HTML5 <audio> tags, that is going to be tough if not impossible.
My first idea was just to suggest http://www.w3schools.com/html5/tag_audio.asp. Usage
<audio src="/sound/ajax.mp3" id="ajaxdone"/>
// ajax success / readystate == 4
var mysound = $('#ajaxdone')[0];
    mysound.play();
But that is also pretty much impossible in IE6 + 7.
In IE You could use <BGSOUND src= loop="1"> tag - append it and remove it before adding another.
I'm not sure which browsers accept that tag, and it's deprecated.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论