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

问题描述:

我有一个java脚本代码,我想检查是否安装了flash播放器,如果安装了哪个版本的话,
要求要求我在不使用SWFObject的情况下实现这一点。而我想要一些简单的JavaScript代码。
我使用了下面的代码片段:

I have a java script code and I want to check if flash player is installed or not and if at all it is installed which version ? Requirement demands me to achieve this without using SWFObject. INstead I want to some simple javascript code. I used the following snippet:

currentVer = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.10");
        version = currentVer.GetVariable("$version");

但是它抛出错误信息,


文件名或类名未找到
在自动操作期间

File name or class name not found during Automation operation

我想实现使用JavaScript编码本身,而不需要像SWFObject一样下载任何软件。
我正在使用IE。
请帮助我。

I want to achieve using javascript coding itself, without downloading any software for it like SWFObject. I am using IE. Kindly help me with this.

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

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