判断浏览器是否安装了flash
		<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>判断浏览器是否安装了flash</title>
</head>
<body>
  <div class="install-flash">
    <a href="https://get2.adobe.com/cn/flashplayer/">如果没有flash,点此安装</a>
  </div>
  <script>
    var isIE = -[1,];
    // 判断如果是ie
    if(!isIE){
      try{
        var swf1 = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
        // console.log('安装了Flash');
      }catch(e){
        // console.log('没有安装Flash');
        hasFlash();
      }
    }else {
      try{
        var swf2 = navigator.plugins['Shockwave Flash'];
        if(swf2){
          // console.log('安装了Flash');
        }else {
          // console.log('没有安装Flash');
          hasFlash();
        }
      }catch(e){
        // console.log('没有安装Flash');
        hasFlash();
      }
    }
    function hasFlash(){
      alert('没有安装Flash');
    }
  </script>
</body>
</html>
	
	
 
 
发表评论: