Spatacoli

Installing Silverlight

If you have been to a web site that is using Silverlight chances are you've seen the medallion that asks you kindly to install this tiny little piece of software. If you have and you skipped it, shame on you. Go find a site that forces you to install Silverlight and do it. I'll wait... Here's one for you to try.

Now the install is fairly painless except for one part. Once the plug-in has been installed you have to either refresh the current page if you are using IE, or you have to restart the browser if you are in Safari or Firefox.

There is a way around the refresh, but it only works in IE. The idea is that if you know the user is going to install the plug-in, just check every 5 seconds if the install has finished. If it has, then refresh the page automatically.

The problem though is that this method only works for IE. That said an IE only fix may still help about 60% of your site viewers. What about the other 40%. The problem with the other browsers is that with the Netscape Plug-in model, the installed plug-ins are only detected at startup. You have to actually close the browser and reopen it. This makes for a large number of drop-off viewers to your site.

At least, that is what I thought. Also, this was the guidance I've been giving people for the past 6 months. I guess I should have looked into the problem a little more. Piotr Puszkiewicz has found a solution.

navigator.plugins.refresh();

Since IE has no clue what this is, IE will throw an exception. Just put this line in a Try/Catch and it should be good in IE, Safari, and Firefox.

Anyway, for a full description and some code samples go to this blog entry:

http://blogs.msdn.com/piotrp/archive/2008/05/02/automatically-start-silverlight-on-install.aspx

Moving forward I'll package this into my install scripts and use it for all sites I'm involved in. Thank you Piotr Puszkiewicz.