问题描述
我正在构建一个基于Ajax的应用程序,该应用程序将在我们的本地Intranet网络上运行.
I am building an Ajax Based application that will run on our local intranet network.
- 现在,每次从Ajax返回请求时,我都需要在客户端浏览器中播放声音.
- 我要将声音文件(mp3/wav)放在要下载应用程序的Web服务器(Tomcat)目录中并在客户端浏览器上播放. (我不想嵌入它,只会自动播放)
- 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 downloadand play at the client browser. (I dont want to embed this and will just automatically play)
但是我基本上有这个限制.
But I basically have this limitation.
- 我们的目标用户Intranet计算机无法访问外部Internet,因为这被我们的网络团队阻止.
- 大多数客户端在Windows XP上运行,并且Flash可能未更新或未安装.
我知道一些jQuery,但是我不知道我在想什么是可能的,以及我可以使用哪种可能的插件,基本上是跨浏览器.我的目标浏览器在IE6/IE7/IE8/FF3上运行.
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.
推荐答案
没有Flash且没有支持HTML5 <audio>
标签的浏览器,即使不是没有可能,这也会很困难.
Without flash and without a browser that supports HTML5 <audio>
tags, that is going to be tough if not impossible.
我的第一个想法只是建议 http://www.w3schools.com/html5/tag_audio.asp .用法
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();
但这在IE6 + 7
中几乎也是不可能的.
But that is also pretty much impossible in IE6 + 7
.
这篇关于播放声音Javascript/Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!