我有两个版本的页面:一个用于显示用户是否已安装Silverlight,另一个用于安装Silverlight。
所以我想显示第一页,如果没有,则重定向到第二页。
答案是given here onSilverlightError函数。
但是,这对我不起作用。我在js1.biz设置了一个测试网站,显示了这一点。如果你去那里,并且没有安装SL,你会看到安装图像。但是,我想将用户重定向到js1.biz/SLNotINstalled.html。
所以问题是,如何让用户访问SLNotInstalled.html?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>RedirectIfSLNotInstalled</title>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
text-align:center;
}
</style>
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
function onSilverlightError(sender, args) {
window.location.assign("http://js1.biz/SLNotInstalled.html");
}
</script>
</head>
<body>
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/RedirectIfSLNotInstalled.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>
</body>
</html>
格雷格
答案 0 :(得分:0)
尝试使用驻留在Silverlight.js中的bool = Silverlight.isInstalled( version );