10 August, 2010

Flash Detection Javascript

This is the simple javascript code to detect whether flash installed on the machine or not!

//Look for a version of Internet Explorer that supports ActiveX (i.e., one that's
//running on a platform other than Mac or Windows 3.1) or a browser that supports
//the plugin property of the navigator object and that has Flash Player 2.0
//The Check for Internet Explorer is needed as it can play native swf files.

var flashSupported;

if (
     (navigator.appName == "Microsoft Internet Explorer" 
          && navigator.appVersion.indexOf("Mac") == -1 
          && navigator.appVersion.indexOf("3.1") == -1) 
     || (navigator.plugins && navigator.plugins["Shockwave Flash"]) 
     || navigator.plugins["Shockwave Flash 2.0"]){
     flashSupported = true;
else {
     flashSupported = false;