Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect flash player version by js [duplicate]

This function always return "0" in IE

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

but chrome return 11.8.r800

how to detect flash player version in IE.

like image 965
Harshit Tailor Avatar asked Aug 17 '13 06:08

Harshit Tailor


People also ask

How do I check what version of Flash Player I have?

There are various ways to detect the Flash Player version that has been installed: Use a Flash Player detector to determine the plugin version of Flash. Go to http://kb2.adobe.com/cps/155/tn_15507.html using your web browser. The version number will be listed. The Adobe Flash Player version required may vary by event.

How do I check my version of Adobe Flash Player on Windows?

Use the Control Panel "Programs and Features" Dialog The version may appear after the title. Run the event login link with the system check to view the Adobe Flash Version required for the specific event. If the required minimum version is not installed, the user should download the latest version.

What is Flash and JavaScript?

Flash and JavaScript are based off ECMAScript. Anything you can do in Flash you can do in JavaScript. JavaScript is a full-featured programming language. It's used to create web applications, video games, particle systems, etc.


3 Answers

I think you will have better luck using the swfobject library. Using this library you can simply do the following to get the flash version across browsers:

// returns a JavaScript object
var playerVersion = swfobject.getFlashPlayerVersion(); 
// access the major, minor and release version numbers via their respective properties
var majorVersion = playerVersion.major; 
like image 104
fijas Avatar answered Oct 07 '22 22:10

fijas


Here is what is used in one of my projects,

Works good also on IE

function getFlashVersion(){
  // ie
  try {
    try {
      // avoid fp6 minor version lookup issues
      // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
      var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
      try { axo.AllowScriptAccess = 'always'; }
      catch(e) { return '6,0,0'; }
    } catch(e) {}
    return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
  // other browsers
  } catch(e) {
    try {
      if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
        return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
      }
    } catch(e) {}
  }
  return '0,0,0';
}

var version = getFlashVersion().split(',').shift();
if(version < 10){
  alert("Lower than 10");
}else{
  alert("10 or higher");
}
like image 23
Hemant_Negi Avatar answered Oct 07 '22 21:10

Hemant_Negi


Try this

    var a, b, c, y ='length',v = "name",t = "indexOf",m = "match";
    if (c=window.navigator.plugins)
        for (var d = 0; d < c[y] && !b; d++) {
            var e = c[d]; - 1 < e[v][t]("Shockwave Flash") && (b = e.description) 
        }
    if (!b) try {
        a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"), b = a.GetVariable("$version")
    } catch (g) {}
    if (!b) try {
        a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"), b = "WIN 6,0,21,0", a.AllowScriptAccess = "always", b = a.GetVariable("$version")
    } catch (ca) {}
    if (!b) try {
        a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"), b = a.GetVariable("$version")
    } catch (l) {}
    b &&
        (a = b[m](/[\d]+/g)) && 3 <= a[y] && (b = a[0] + "." + a[1] + " r" + a[2]);
    console.log(b) || void 0
like image 1
Karthick Selvam Avatar answered Oct 07 '22 23:10

Karthick Selvam