Skip to content

Instantly share code, notes, and snippets.

@nokimaro
Forked from dciccale/LICENSE.txt
Created December 18, 2016 01:58
Show Gist options
  • Save nokimaro/eae156f803d2fd1de36269c9f43e2633 to your computer and use it in GitHub Desktop.
Save nokimaro/eae156f803d2fd1de36269c9f43e2633 to your computer and use it in GitHub Desktop.
Detect if Flash Player is installed in your browser (120bytes)
function(
a, // 'Shockwave'
b, // 'Flash'
) {
// try creating an AxtiveXObject (internet explorer use this object)
try {
a = new ActiveXObject(a+b+'.'+a+b);
}
// if fails, is not ie, so check for the navigator.plugins object
catch ( e ) {
a = navigator.plugins[a+' '+b];
}
// return true/false
return!!a;
}('Shockwave','Flash') // auto-run passing the name of Flash Player plugin
function(a,b){try{a=new ActiveXObject(a+b+'.'+a+b)}catch(e){a=navigator.plugins[a+' '+b]}return!!a}('Shockwave','Flash')
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Denis Ciccale <http://webdecs.wordpress.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "hayFlash",
"description": "Detect if Flash Player is installed in your browser",
"keywords": [
"detect",
"flash",
"player",
"browser"
]
}
<!doctype html>
<head>
<title>Detect Flash Player</title>
<script>
var hayFlash = function(a,b){try{a=new ActiveXObject(a+b+'.'+a+b)}catch(e){a=navigator.plugins[a+' '+b]}return!!a}('Shockwave','Flash')
if(hayFlash) {
alert("Flash Player is installed");
}
else {
alert("Your browser doesn't have Flash Player installed");
}
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment