admin管理员组文章数量:1429504
I want to play a sound notification, so I used the method described here: Cross-platform, cross-browser way to play sound from Javascript? However, when quicktime is not installed on the client machine, everytime the soundPlay
function is called, a windows popup shows up. It says that quicktime is not installed, and proposes to install it.
For user experience, I would like not to bother users without quicktime like this:
function hasQuickTime() {
// how do I know ?
}
// play sound only if quickTime is installed
if (hasQuickTime()) {
soundPlay();
}
I want to play a sound notification, so I used the method described here: Cross-platform, cross-browser way to play sound from Javascript? However, when quicktime is not installed on the client machine, everytime the soundPlay
function is called, a windows popup shows up. It says that quicktime is not installed, and proposes to install it.
For user experience, I would like not to bother users without quicktime like this:
function hasQuickTime() {
// how do I know ?
}
// play sound only if quickTime is installed
if (hasQuickTime()) {
soundPlay();
}
Share
Improve this question
edited May 23, 2017 at 12:31
CommunityBot
11 silver badge
asked Oct 12, 2011 at 18:41
Benjamin CrouzierBenjamin Crouzier
42k48 gold badges178 silver badges239 bronze badges
1
- Here is basically the same script: dithered.chadlindstrom.ca/javascript/quicktime.html But you might prefer the more specific examples and the detailed way things are explained. – user1876262 Commented Dec 4, 2012 at 15:56
1 Answer
Reset to default 6See Apple's JavaScript Scripting Guide: Detecting QuickTime with JavaScript
var haveqt = false;
if (navigator.plugins) {
for (i=0; i < navigator.plugins.length; i++ ) {
if (navigator.plugins[i].name.indexOf
("QuickTime") >= 0)
{ haveqt = true; }
}
}
if ((navigator.appVersion.indexOf("Mac") > 0)
&& (navigator.appName.substring(0,9) == "Microsoft")
&& (parseInt(navigator.appVersion) < 5) )
{ haveqt = true; }
You can test the variable haveqt
for the presence of QuickTime.
本文标签: windowsHow do I detect if quicktime is installed with javascriptStack Overflow
版权声明:本文标题:windows - How do I detect if quicktime is installed with javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745447405a2658726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论