Skip to content

Instantly share code, notes, and snippets.

@karlhorky
Created November 16, 2014 16:50
Show Gist options
  • Save karlhorky/6557ea67925eaaadeea0 to your computer and use it in GitHub Desktop.
Save karlhorky/6557ea67925eaaadeea0 to your computer and use it in GitHub Desktop.
Flash Feature Detect
<!doctype html>
<html class="no-flash" lang="en">
<head>
<script>
(function() {
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) {
hasFlash = true;
}
} catch (e) {
if (navigator.mimeTypes
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
hasFlash = true;
}
}
if (hasFlash) {
html = document.getElementsByTagName('html')[0];
html.className = html.className.replace('no-flash', '');
}
})()
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment