Silverlight 降级为 html
我有兴趣完全使用 silverlight 创建一个网站(个人原因),但我不希望尚未安装 silverlight 的人(很多)必须安装插件才能查看我的网站。 我倾向于的解决方案是从网站的平面 html/css 版本开始,并仅向已经安装它的人提供 silverlight 版本。
我的问题是:
我的推理是否被误导了? 有没有更好的方法来解决这个问题。 避免在网站的两个版本之间重复内容的最佳方法是什么?
I am interested in creating a website entirely in silverlight (personal reasons) but I don't want people who don't yet have silverlight (a good many) to have to install a plugin just to view my site. The solution I am leaning towards is to start with a flat html/css version of the site and present the silverlight version only to people who already have it installed.
My question is this:
Is my reasoning misguided. Is there a better way to go about this. And what is the best way to avoid having to duplicate content across both versions of the site.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这取决于你所说的“内容”是什么意思。
如果“内容”指的是驱动网站的代码,那么您将需要将所有内容编写两次,而我没有看到任何解决方法。
如果“内容”指的是代码所呈现的内容,那么可以做一些事情来减少重复。 如果您以 XML 等已知格式存储内容,则可以在 HTML/CSS 端使用 XSLT 将 XML 转换为 HTML 以便呈现。 然后,在 Silverlight 端,您还可以解析 XML 并以您想要的任何格式显示它。 使用这种技术,您只需重写框架来显示内容。
It depends on what you mean by "content".
If by "content" you mean the code driving the website, then you're going to need to write everything twice and I don't see any way around that.
If by "content" you mean the what the code is presenting, then can do some things to reduce duplication. If you store your content in a known format like XML, you can use XSLT on the HTML/CSS side to transform the XML into HTML for rendering. Then on the Silverlight side you can also parse the XML and display it in whatever format you want. With this technique, you're just rewriting the framework to display the content.
我建议您阅读 SilverSpine,这是一种由 McCann 开发的管理技术这种类型的 Silverlight/XHTML 集成。
迈克尔
I would recommend reading about SilverSpine, a technique developed by McCann to manage this type of Silverlight/XHTML integration.
Michael
如果你可以使用 Flash,那么 99.9% 的访问者都会拥有该插件。
well you could use Flash, then 99.9% of your visitors will have the plugin.
我个人喜欢网站的优雅降级。 我希望在我的网站上安装 Silverlight,但我在 Twitter 上看到有人访问 Silverlight 网站并说 - 我绝对不会安装该插件。 所以这些人也必须得到安置。
我写了一篇有关 Silverlight Island 的文章,介绍了如何使用 JQuery 来实现。 此方法提供了搜索引擎材料,它为非 Silverlight 爱好者提供了一种使用该网站的方式,并且它为您提供了一种随心所欲地享受您的网站的方式。
但这还有很多工作要做。
http://www.faxt.com/blog/post/2008/09/Show-Multiple-Silverlight-Controls-in-the-Same-Page-with-jQuery.aspx
I personally like graceful degradation for a web site. I want Silverlight on my site, but I see people on Twitter who come to a Silverlight site and say - no way will I install that plug-in. So those people must be accommodated too.
I wrote about Silverlight Islands, how to implement using JQuery. This method provides search engine material, it provides a way for non-Silverlight lovers to use the site, and it provides a way for you to enjoy your web site as you wish.
But it's a lot more work.
http://www.faxt.com/blog/post/2008/09/Show-Multiple-Silverlight-Controls-in-the-Same-Page-with-jQuery.aspx
首先,为没有 Silverlight 插件的用户提供底层体验是一个非常好的做法。 它还将为您的网站提供更好的 SEO。 如果您有能力使用 Silverlight 3 和 ASP.NET,那么 .NET RIA 服务对于跨 Silverlight 和 ASP .NET 重用代码来说是一个非常有吸引力的选择。 Ria 服务和教程可在此处获取:
http://code.msdn.microsoft.com/RiaServices
First, providing a downlevel experience for users without Silverlight plugin is a very good practice. It will also provide better SEO for your site. If you can afford to use Silverlight 3 and ASP.NET then .NET RIA services is a very attractive option for reusing code across Silverlight and ASP .NET. Ria services, and tutorials are available here:
http://code.msdn.microsoft.com/RiaServices
进行快速搜索后,我发现此页面可能有用:
http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight/ DetectSilverlight/Default.html
也许使用该方法来检测 Silverlight,您可以将 Silverlight 用户重定向到真实的 Silverlight 页面和/或将其他用户重定向到常规 html 页面。
Doing a quick search I found this page which may be useful:
http://www.adefwebserver.com/DotNetNukeHELP/Misc/Silverlight/DetectSilverlight/Default.html
Perhaps using that method to detect Silverlight you can redirect the users with Silverlight to your real Silverlight page and/or redirect other users to a regular html page.
查看 unobtrusify.com,它是针对不引人注目的 javascript 的,但同样的推理也成立。
另外,请查看 Scott Guthrie 的关于未安装 Silverlight 的博客:weblogs.asp.net/scottgu/archive/2007/10/30/optimizing-the-silverlight-install-experience.aspx
如果您不想重复,我可以说,将 HTML 放在给定的 div 标签中,并将它们拉入您的 Silverlight 应用程序中,有效地将其用作不同的表示层。 您可以使用 Javascript 库根据用户是否安装了 Silverlight 来显示/隐藏该 HTMl。
Check out unobtrusify.com, it's for unobtrusive javascript, but the same reasoning holds.
Also, check out Scott Guthrie's blog on not having Silverlight installed: weblogs.asp.net/scottgu/archive/2007/10/30/optimizing-the-silverlight-install-experience.aspx
If you don't want to duplicate, I'd say have the HTML in given div tags and pull those into your Silverlight application, effectively using it as a different presentation layer. You can use a Javascript library to show/hide that HTMl based on if a user as Silverlight installed.