views:

363

answers:

3

I want to have two separate interfaces to my website, one that is silverlight, and one that is normal html for people who don't have Silverlight, and for search engines. They would have exactly the same content, the Silverlight one would just be a richer experience.

If someone with Silverlight copies the URL to a certain page, it will have a '#' in it (app#page1). If they then want to link to that page on their blog or something, it will have the # in it, and a search engine probably wouldn't consider it as a separate page from app#page2.

Is there any way to make the navigation from within Silverlight update the URL with a '/' instead of a '#', without actually loading a separate page? This way the URLs in the address bar appear like a normal websites' URLs ('app/page1', 'app/page2').

+5  A: 

Is there any way to make the navigation from within Silverlight update the URL with a '/' instead of a '#', without actually loading a separate page? This way the URLs in the address bar appear like a normal websites' URLs ('app/page1', 'app/page2').

Unfortunately, no. The reason that Silverlight navigation URLs use # is that you can move around within a page by moving to an anchor location. If you used a full URL with '/' separators, it would cause the browser to navigate to a new page, which would reload your Silverlight application. This would basically unload your Silverlight application, and load a new one with the new URL.

Reed Copsey
+1  A: 

The reason they use the # sign is because this is interpreted by the browser as moving to a location in the page, otherwise would reload the page.

As far as search engine implications I'm not sure either way. Maybe someone more experienced with SEO can chime in on that.

However I'm sure you can get the behavior you're looking for, just may take some trickiness on your end. Another way pass information to the Silverlight client runtime is using Query String parameters. You can access query string params using the System.Windows.Browser.HtmlPage.Document.QueryString collection, you could then load the Page or User control with the content you desire based on that parameter.

As far as mimicking a folder structure using '/'s. I know there are ways to do this using custom web server settings / HTTPModules. I assume you're using IIS/ASP.Net, I would look into this from Guthrie:

http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

Takes a bit of hackery, but if you're really set on doing it I'm sure you could. You will also face the things the above poster mentioned, if you attempt to do use the same logic during a session. This may work though for just the deep linking aspect you're looking for.

James Hollister
A: 

Here is the solution I am thinking of, assuming I have to use the '#'s:

If anyone navigates to my site with a hash in the URL (app#page1), I will just show the main page but have a prominent box on the page say "Did you mean app/page1 ('/' instead of '#')?". Hopefully some people that link to a page from my site in their blog would test out their link and see that they should use slash and redo it. For others that don't, it will still be a link to my site for SEO, just not as good as if it linked directly to the specific page.

Since this makes my site less friendly to link to in the Silverlight version, I am thinking I will just not do the Silverlight version of the site at all.

Thoughts?

Kyle
I would skip the "Did you mean" box and just do a 301 redirect ("moved permanently") to the correct URL.
kpozin