Detecting Silverlight Version Installed

Detecting the Silverlight version installed on a client machine isn’t entirely straightforward. To do so, one has to use Javascript. Unfortunately even though Microsoft ships a Silverlight.js in the Silverlight SDK, this script only has the ability to tell whether a specific version is supported on the client’s machine; it does not support returning the installed version.

For this reason I have created a simple Javascript function returning the Silverlight version number installed on the client machine or returning -1 if Silverlight is not installed. The source code can be downloaded from here:
SilverlightVersion.js
The script can be used the following way:

var slVersion = GetSilverlightVersion();
if(slVersion != -1)
   document.writeln("Your Silverlight version is: <strong>" +slVersion + "</strong>" );
else
   document.writeln("<strong>Your do not have Silverlight installed on this computer</strong>");

And this is the script in action:

If you’re interested in how the script actually works and what the Silverlight version numbers mean, read the post on my ScottLogic blog: Determining Silverlight Version Installed – source code & explanation

One Response to Detecting Silverlight Version Installed
  1. Trackback: DotNetShoutout
    Detecting Silverlight Version Installed - Greg Does IT... Thank you for submitting this cool... dotnetshoutout.com/Detecting-Silverlight-Version-Installed-Greg-Does-IT