Detecting user’s installed version of the Silverlight plug-in

Microsoft’s Silverlight plugin is finding its way to more and more high profile websites.  NBC used it to broadcast the Beijing Olympics and major sport sites are using to show live games and highlights.  (I should note that Silverlight is capable of much more than video playback, but that’s primarily what we’ve seen it used for recently.)

The JavaScript code which Microsoft provides to help with plug-in detection and rendering is, while helpful, not entirely complete.  For example, it currently lack a means of detecting the installed version.  This could be useful for tracking plugin penetration among your users, etc.  Here’s a simple script for detecting which, if any version of Silverlight is installed on a visitor’s computer.

var SilverlightVersion = "";

try { // SL version detection for Internet Explorer
	var control = new ActiveXObject('AgControl.AgControl');
	if (control.IsVersionSupported("1.0")){ SilverlightVersion = "1"; }
	if (control.IsVersionSupported("2.0")){ SilverlightVersion = "2"; }
	control = null;
catch (e) { // SL version detection for non-IE browsers
	var plugin = navigator.plugins["Silverlight Plug-In"] ;
	if (plugin){ SilverlightVersion = plugin.description.substring(0,1);	}

if (SilverlightVersion !== ""){
	document.write("Your browser supports Silverlight version: " + SilverlightVersion);
else {
	document.write("You do not have Silverlight installed.");

2 Comments on “Detecting user’s installed version of the Silverlight plug-in”

  1. I was looking for a complete version for IE and non-IE browsers detection method
    some AgControl.AgControl older methods that check settings.version doesnt work with SL2 but this methods works like a charm


  2. Thank you soo much for this post! Was trying to find a list of methods/properties exposed by AgControl.AgControl, but couldn’t. Tried the summary.version, and that didn’t work either.

Leave a Reply

Your email address will not be published. Required fields are marked *