检测插件

2017-06-16 15:27:00
admin
原创
557
<!DOCTYPE html>
<html>
<head>
    <title>Plugin Detection Example</title>
</head>
<body>
    <script type="text/javascript">
    
        //plugin detection - doesn't work in IE
        function hasPlugin(name){
            name = name.toLowerCase();
            for (var i=0; i < navigator.mimeTypes.length; i++){
                if (navigator.mimeTypes[i].name.toLowerCase().indexOf(name) > -1){
                    return true;
                }
            }
        
            return false;
        }
        
        //detect flash
        alert(hasPlugin("Flash"));
        
        //detect quicktime
        alert(hasPlugin("QuickTime"));
        
        //detect Java
        alert(hasPlugin("Java"));
    </script>
</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络