检测客户端是否安装 Silverlight 插件

<script type="text/javascript">
function CheckSilverlightInstalled()
{
 var isSilverlightInstalled = false;
 try{
  try{
   var slControl = new ActiveXObject('AgControl.AgControl');//检查IE
   isSilverlightInstalled = true;
  }
  catch(e){  
   if(navigator.plugins["Silverlight Plug-In"]) //检查非IE
   {
    isSilverlightInstalled = true;
   }
  }
 }
 catch(e){}
 return isSilverlightInstalled;
}
alert("是否安装了 Silverlight 插件?" + CheckSilverlightInstalled())
</script>

 

你可能感兴趣的:(silverlight)