JS判断浏览器是否支持flash的方法

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');
    }
}

 

你可能感兴趣的:(JavaScript,Flash)