Skip to main content

Answered Question detecting Silverlight versionRSS Feed

(0)

decius
decius

Member

Member

26 points

66 Posts

detecting Silverlight version

I'm perplexed here. This seems so simple and straight forward, but the isInstalled method in Silverlight.js doesn't seem to be working for me correctly at all.

using the information provided here:

http://msdn.microsoft.com/en-us/library/cc838126(VS.95).aspx#isinstalled

I created a simple page using this script in the head of the page

 if (Silverlight.isInstalled("3.0")) alert ("Congrats. Your web browser is enabled with Silverlight Runtime");

However when the page loads Silverlight.isInstalled("3.0") always returns true, whether it is installed or not! Is there something I'm missing???

pbromberg
pbromberg

Contributor

Contributor

2326 points

404 Posts

Re: detecting Silverlight version

Working sample:

<HTML>
 <HEAD> 
  <script type="text/javascript" src="silverlight.js" > </script>
  <script type="text/javascript" > 
  function checkSl(version)
  {
 alert( Silverlight.isInstalled(version) );
  }
    </script>
 </HEAD> 
 <BODY onload="checkSl('3.0.40624');">
 
 </BODY>
</HTML>

This shows "true" on my machine, which has Silverlight 3 installed.

decius
decius

Member

Member

26 points

66 Posts

Answered Question

Re: detecting Silverlight version

Thanks pbromberg, but my problem was that it seemed to be returning true for ALL cases (even if it wasn't really installed!). 

I checked msdn to find that I had an older version of Silverlight.js. I updated it with the latest download (http://code.msdn.microsoft.com/silverlightjs) and that has solved my problem. Not really sure if anyone else has experienced this or not, but it took me several hours of running around confused to come to this.

setiri
setiri

Member

Member

4 points

2 Posts

Re: detecting Silverlight version

Some javascript on this page detects and displays the actual version number of the installed silverlight-> silverlight version

decius
decius

Member

Member

26 points

66 Posts

Re: Re: detecting Silverlight version

Thanks, though the problem I was having was solved some time ago and was caused by having an outdated version of the Silverlight.js file, as stated above. The issue wasn't related to showing a specific version, but was rather that an incorrect behavior was happening regarding the Silverlight.js API. Thanks for the input though.

setiri
setiri

Member

Member

4 points

2 Posts

Re: Re: detecting Silverlight version

Sure, no problem.

The linked silverlightversion site has code that can find the exact silverlight version you have installed, in case you or someone finding this page later can use it. It's kinda funny what a hack it requires to do this ;)

DJanjicek
DJanjicek

Participant

Participant

971 points

331 Posts

Re: detecting Silverlight version

pbromberg:

Working sample:

<HTML>
 <HEAD> 
  <script type="text/javascript" src="silverlight.js" > </script>
  <script type="text/javascript" > 
  function checkSl(version)
  {
 alert( Silverlight.isInstalled(version) );
  }
    </script>
 </HEAD> 
 <BODY onload="checkSl('3.0.40624');">
 
 </BODY>
</HTML>

This shows "true" on my machine, which has Silverlight 3 installed.

What if the installed version is higher/more recent than the passed one? Will it return true?

decius
decius

Member

Member

26 points

66 Posts

Re: detecting Silverlight version

This thread was created for troubleshooting unexpected behaviour in the Silverlight.js. The problem I had was that there was in fact a bug that occured because I was using an older version of the js file. Thus, this isn't the best thread to ask that on, but here it is.

Below is the documentation for a properly working api which can be found here http://msdn.microsoft.com/en-us/library/cc838126(VS.95).aspx . If the user has the specified version or below, will return true, otherwise false.

------------------------------------------------------------------------------------------------------------------

 isInstalled

Indicates whether the specified version of Silverlight is installed.

Syntax

bool = Silverlight.isInstalled(version);

Parameters

version

A string that represents a Silverlight version number. For information about the version number, see Silverlight Plug-in Versioning.

Return Value

true if the specified version of Silverlight is installed; otherwise, false.

 

DJanjicek
DJanjicek

Participant

Participant

971 points

331 Posts

Re: detecting Silverlight version

decius:

If the user has the specified version or below, will return true, otherwise false.

You mean, if the user has the specified version or above will return true, otherwise false... right? Below doesn't make much sense

  • Unanswered Question
  • Answered Question
  • Announcement