且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何以编程方式检查是否安装了特定版本的Flash播放器或不使用JavaScript。

更新时间:2023-09-26 18:59:10

你大部分都是在这里,你只是错过了测试一部分。不幸的是,没有办法访问给定的属性,告诉你你想要什么。您必须尝试创建对象。

You have most of it right there, you're just missing the testing part of it. Unfortunately there isn't really a way to access a given property that tells you what you want. You have to try to create the object.

function getFlashVersion(){
 var flash = 'None';
 // Count down from 10.
 for(var i = 10; i > 0; i--)
 {
   try{
    flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+String(i));
   }catch(e){
     //console.log(e);
   }
   if(flash != 'None')
    return flash.GetVariable("$version");

 }
 return 0;
}