function CheckSLInstalled() {
var isSLInstalled = false;
try {
try {
var slControl = new ActiveXObject('AgControl.AgControl'); //检查IE
isSLInstalled = true;
}
catch (e) {
if (navigator.plugins["Silverlight Plug-In"]) //检查非IE
{
isSLInstalled = true;
}
}
}
catch (e) { }
return isSLInstalled;
}
调用的地方(安装过之后返回 true,没安装过返回 false ):
<script type="text/javascript" language="javascript">
alert("是否安装了 Silverlight 插件?" + CheckSLInstalled())
</script>