Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming Programming with .NET - General detecting Silverlight version
8 replies. Latest Post by DJanjicek on November 21, 2009.
(0)
decius
Member
26 points
66 Posts
10-15-2009 1:41 PM |
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
Contributor
2326 points
404 Posts
10-15-2009 8:24 PM |
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.
10-19-2009 10:49 AM |
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
4 points
2 Posts
11-10-2009 4:14 PM |
Some javascript on this page detects and displays the actual version number of the installed silverlight-> silverlight version
11-10-2009 4:22 PM |
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.
11-10-2009 4:30 PM |
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
Participant
971 points
331 Posts
11-20-2009 3:58 PM |
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?
11-20-2009 4:13 PM |
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.
bool = Silverlight.isInstalled(version);
version
A string that represents a Silverlight version number. For information about the version number, see Silverlight Plug-in Versioning.
true if the specified version of Silverlight is installed; otherwise, false.
11-21-2009 4:01 AM |
decius: If the user has the specified version or below, will return true, otherwise false.
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