Created
February 11, 2014 10:20
-
-
Save yvesvanbroekhoven/8932391 to your computer and use it in GitHub Desktop.
Javascript check if Flash installed & enabled
This file contains 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
/** | |
* Check if Flash is installed & enabled | |
* http://stackoverflow.com/questions/998245/how-can-i-detect-if-flash-is-installed-and-if-not-display-a-hidden-div-that-inf | |
* | |
* @return {Boolean} | |
*/ | |
var hasFlash = function() { | |
var has_flash = false; | |
try { | |
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); | |
if (fo) { | |
has_flash = true; | |
} | |
} catch (e) { | |
if (navigator.mimeTypes | |
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined | |
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) { | |
has_flash = true; | |
} | |
} | |
return has_flash; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment