使用 Silverlight 进行渐进式增强

发布于 2024-08-03 18:37:03 字数 191 浏览 8 评论 0原文

我可以使用 Javascript 检测客户端是否具有在页面中运行 Silverlight 部分所需的运行时,并加载(如果有),否则在该区域留下静态图像或其他内容?

我想向页面添加一些 Silverlight,但它不是页面的重要部分,因此如果他们没有安装它,我宁愿默默地退回到纯粹的 Web 标准内容,而不是放置一些要求他们安装的东西。

Can I detect with Javascript if the client has the needed runtime to run a Silverlight section in a page, and load if if they do, otherwise leave a static image or something in that area?

I would like to add some Silverlight to a page, but it's not an important part of the page so I would rather just silently fall back to pure web standard stuff if they don't have it installed rather than putting up something that asks them to install it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫瑟鸿黎 2024-08-10 18:37:03

标准示例页面(例如当您从 Visual Studio 运行 silverlight 应用程序时构建的页面)可以为您处理此问题。

   <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="SilverlightApplication1.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="3.0.40624.0" />
      <param name="autoUpgrade" value="true" />
      <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
      </a>
    </object>

请注意,当对象标签无法实例化与该类型关联的对象时,它会呈现内部 html。因此可以修改内部 html 以显示您认为合适的后备内容。

The standard example page such as the one built when you run a silverlight app from visual studio handles this for you.

   <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="SilverlightApplication1.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="3.0.40624.0" />
      <param name="autoUpgrade" value="true" />
      <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
      </a>
    </object>

Note that when an object tag is unable instance the object associated with the type it renders inner html present instead. So could modify the inner html to display what ever you feel is an appropriate fallback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文