Created
January 2, 2010 03:15
-
-
Save melchoy/267364 to your computer and use it in GitHub Desktop.
Flash Player Detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************** | |
* Flash Player Detection (taken from sifr ) | |
**********************************************/ | |
var hasFlash = function(){ | |
var nRequiredVersion = 9; | |
if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){ | |
document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n</script\> \n'); | |
/* If executed, the VBScript above checks for Flash and sets the hasFlash variable. | |
If VBScript is not supported it's value will still be undefined, so we'll run it though another test | |
This will make sure even Opera identified as IE will be tested */ | |
if(window.hasFlash != null){ | |
return window.hasFlash; | |
}; | |
}; | |
if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){ | |
var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description; | |
return parseInt(flashDescription.substr(flashDescription.indexOf(".") - 2, 2), 10) >= nRequiredVersion; | |
}; | |
return false; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment