如何以编程方式检查是否安装了特定版本的Flash播放器或不使用JavaScript。 [英] How to programatically check if a particular version of flash player is installed or not using JavaScript.?

查看:296
本文介绍了如何以编程方式检查是否安装了特定版本的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;
}

这篇关于如何以编程方式检查是否安装了特定版本的Flash播放器或不使用JavaScript。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆