您的位置:首页 > Web前端 > JavaScript

JavaScript判断是否安装所需版本的flash插件

2010-10-11 19:26 531 查看
<mce:script type=text/javascript><!--
function checkFlash() {
var i_flash;    //是否安装flash插件
var v_flash;    //flash插件的版本号
var v_require = 10; //flash插件要求的版本号
// Netscape
if (navigator.plugins && navigator.plugins.length) {
for (var i=0; i < navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase().indexOf("shockwave flash") >= 0) {
i_flash = true;
v_flash = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("flash")
+ 6, navigator.plugins[i].description.length);
v_flash = parseFloat(v_flash);
if (v_flash >= v_require) return true;
}
}
return false;
}
//IE
else if (window.ActiveXObject) {

try {
i_flash = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+v_require);
return true
}catch(e) {
return false;
}
}
}
if (checkFlash())
alert('pass');
else
alert('failed');
// --></mce:script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: