<script type="text/javascript">
function checkSl() {
var isInstalled = false;
try {
try {
var slControl = new ActiveXObject('AgControl.AgControl'); isInstalled = true;
}
catch (e) {
if (navigator.plugins["Silverlight Plug-In"]) {
isInstalled = true;
}
}
}
catch (e)
{
}
return isInstalled;
}
if (checkSl()) {
location.href = "http://www.cnblogs.com";
}
</script>
IE将silverlight看作Activex控件,因此可以试着用javascript创建这个activex,如果创建失败可以认为没有安装silverlight;对于其他浏览器如firefox等,可以通过观察浏览器对象数组的silverlight插件,silverlight安装后叫Silverlight Plugs-In