Greg Does IT

Do it to get it

About

The blog of Gergely Orosz on IT related topics: web, software design, .NET, PHP and the rest. Follow me @gergelyorosz on Twitter.

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

Shout it kick it on DotNetKicks.com
Bookmark and Share

One Response to “Detecting Silverlight Version Installed”

  1. Detecting Silverlight Version Installed – Greg Does IT…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

    DotNetShoutout

Leave a Reply