So, you've just created a great Silverlight application and you want everyone to enjoy it. You, of course, have the Silverlight runtime already installed but what about users who don't have a current version of Silverlight or, worse, are on an unsupported platform?
You could leave them with the standard silverlight.js experience but, let's be honest, it's probably not going to reflect that well against the carefully crafted user experience of your application is it? That said, you've got deadlines and developing install experiences isn't the most exciting task on your to-do list is it?
The Silverlight Install and Logging Framework (SILF) is designed to make that job a little easier for you. Without much more work than designing some screens for a few possible install conditions it handles all the logic and guides the user through install or upgrade experiences and, if you want, even logs the results so you can see what’s working and where you need to tweak the solicitation to make it more attractive.
Although the full blown thing looks a bit intimidating it’s actually really easy to get started with the basics and then elaborate
<!-- Install the Silveright install and logging controller -->
// Configure logging parameters
SILF.minSlVersion = "3.0.50106.0"; // Required Silverlight version
SILF.SilverlightControlHost = "silverlightControlHost"; // div which contains Silverlight control
// Use this section to configure messages
SILF.PromptInstall = "Please <a href='#' onclick='SILF.InstallClicked()'>click here to install Silverlight</a>";
SILF.PromptFinishInstall = "Please wait for Silverlight installation to complete. You may need to refresh the page.";
SILF.PromptUpgrade = "Please <a href='#' onclick='SILF.UpgradeClicked()'>click here to upgrade Silverlight</a>";
SILF.PromptFinishUpgrade = "Please wait for Silverlight upgrade to complete. You will need to restart your browser.";
SILF.PromptRestart = "Please exit/quit and restart your browser to proceed";
SILF.PromptNotSupported = "Sorry, your browser or operating system are not supported";
// If you want to redirect on Silverlight not supported, rather than show a slate, enable this variable
// SILF.RedirectNotSupported = "http://bing.com";
<div id="silverlightControlHost" style="height:100;">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="940" height="406">
<param name="Source" value='SmoothStreamingSamplePlayer.xap' />
<param name="InitParams" value='fakemode=,background=#FF000000,autoload=False,autoplay=False,muted=False,stretchmode=0,playlist=<playList><playListItems><playListItem title="Smooth Streaming : Media : Test" description="" mediaSource="http://mediadl.microsoft.com/mediadl/iisnet/smoothmedia/Experience/BigBuckBunny_720p.ism/Manifest" adaptiveStreaming="True" thumbSource=""></playListItem></playListItems></playList>' />
<param name="windowless" value="false" />
<param name="background" value="black" />
<param name="minRuntimeVersion" value="3.0.50106.0" />
<param name="autoUpgrade" value="false" />
<param name="onerror" value="onSilverlightError" />
<param name="onload" value="onSilverlightLoad" />
The code owes a lot to the work of Laurence Moroney and Tim Heuer as well as experiences on sites such as Sunday Night Football, FranceTV Olympics and RedBullStratos. It consolidates the current silverlight.js as well as including and extending silverlightSupportedUserAgent.js and silverlightVersion.js and, for the logging functions uses the math.uuid.js library.
In advance of a move to a proper community sources project I’d love to hear your feedback below so we can make this more versatile and useful. If you use it please let us know as well.