faqts : Computers : Programming : Languages : JavaScript : Browser Settings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

104 of 122 people (85%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

swf = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); used for detecting the plugin gives an error. Please help.

Jan 16th, 2006 06:22
Guido Hein, No Name, Henrik Gemal, Aravind Srinivasan,


/*********
Check for Flash-Plugin and get Version Information (not supported in all
IE Versions)
**********/

It doesn't work in all Versions of IE to detect the Flash Plugin
correctly. I used following code to detect Flash Plugin and it works on
most Browsers, but not every Version of Internet Explorer. I hope it
will help you.

First it checks for the Filename of the Plugin (different in IE and Opera)
Then it checks per Mime-type like you did it and if it finds the plugin
it gets the Version number.


function chkFlash(){
var plugin=0;
  for(var i=0; i<navigator.plugins.length; i++){
      if (navigator.plugins[i].filename == "NPSWF32.dll" ||
navigator.plugins[i].filename == "flash.ocx"){
	plugin=1;
      } else plugin = 0;
      var pluginIdent = navigator.plugins[i].description.split(" ");
      if(pluginIdent[0] == "Shockwave" && pluginIdent[1] == "Flash"){
        var isSwfEnabled = true;
        versionArray = pluginIdent[2].split(".");
      }
  }
  if (navigator.mimeTypes["application/x-shockwave-flash"]){
   
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin !=
null)plugin=1;
  }
return plugin;
}




If you are looking for an easy way to detect flash without any scripting
language look here:
http://www.macromedia.com/support/flash/ts/documents/scriptfree_detection.htm