Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
</body>
</html>
 
function detectPlugin(substrs) {
    if (navigator.plugins) {
        for (var i = 0; i < navigator.plugins.length; i++) {
            var plugin = navigator.plugins[i];
            var haystack = plugin.name + plugin.description;
            var found = 0;
            for (var j = 0; j < substrs.length; j++) {
                if (haystack.indexOf(substrs[j]) != -1) {
                    found++;
                }
            }
            
            if (found == substrs.length) {
                return true;
            }
        }
    }
    return false;
}
if ( detectPlugin( [ "Shockwave", "Flash" ] ) ) alert( 'yay' );
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers