问题
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.
回答1:
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
回答2:
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
回答3:
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.
回答4:
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.
回答5:
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.
回答6:
I would recommend reading about SilverSpine, a technique developed by McCann to manage this type of Silverlight/XHTML integration.
Michael
回答7:
well you could use Flash, then 99.9% of your visitors will have the plugin.
来源:https://stackoverflow.com/questions/882828/silverlight-that-degrades-to-html