js判断当前电脑是否安装flash插件

xiaoxiao2025-07-10  10

if (!testingFlash()) { dialog("您的浏览器还没有安装flash插件或未允许本站运行,导致上传按钮无法加载,请检查flash插件后重试!"); } /** * 返回true表示已经安装了Flash * 返回flase表示没有安装Flash * @returns {Boolean} */ function testingFlash(){ var fls = flashChecker(); if(fls.f) { return true; }else{ return false; } } function flashChecker(){ var hasFlash = 0; //是否安装了flash var flashVersion = 0; //flash版本 if(document.all) { var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); 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 = navigator.plugins["Shockwave Flash"]; 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 }; }

 

转载请注明原文地址: https://www.6miu.com/read-5032852.html

最新回复(0)