Flash版本检测JS代码

function flashChecker()
{
    var hasFlash=0;             //是否安装了flash
    var flashVersion=0;            //flash版本
    var isIE=/*@cc_on!@*/0;      //是否IE浏览器

    if(isIE)
    {
        var  swf  = null;
        try{ swf=  new  ActiveXObject('ShockwaveFlash.ShockwaveFlash');  }catch(e){}
        if(swf) {
            hasFlash=1;
            VSwf=swf.GetVariable("$version");
            flashVersion=parseInt(VSwf.split(" ")[1].split(",")[0]);        
        }
    }else{
        if (navigator.plugins && navigator.plugins.length > 0)
        {
            var swf= null;
            try{ swf=navigator.plugins["Shockwave Flash"]; }catch(e){}
            if (swf)
             {
                 hasFlash=1;
                var words = swf.description.split(" ");
                for (var i = 0; i < words.length; ++i)
                {
                    if (isNaN(parseInt(words[i]))) continue;
                    flashVersion = parseInt(words[i]);
                }
            }
        }
    }

    return {f:hasFlash,v:flashVersion};
}


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.