js判断浏览器是否安装Flash

 function detectFlash() {
                if (navigator.mimeTypes.length > 0) {
                    return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null;
                } else if (window.ActiveXObject) {
                    try {
                        new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                        return true;
                    } catch (oError) {
                        return false;
                    }
                } else {
                    //no way to detect!
                    return false;
                }
            }
            
            if (detectFlash()){
                alert("You have Flash installed.");
            } else {
                alert("You do not have Flash installed.");
            }

posted @ 2015-06-14 18:11  码农CC  阅读(168)  评论(0编辑  收藏  举报