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

JS 判断浏览器是否安装Flash 兼容IE、firefox

2012-03-12 16:20 603 查看
在网上查了很多,都不好使,最后自己查资料写了下面的方法,代码如下:

var isIE = !-[1,];

if(isIE){

try{

var swf1 = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');

alert('安装了Flash');

}

catch(e){

alert('没有安装Flash');

}

}

else {

try{

var swf2 = navigator.plugins['Shockwave Flash'];

if(swf2 == undefined){

alert('没有安装Flash');

}

else {

alert('安装了Flash');

}

}

catch(e){

alert('没有安装Flash');

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: