Mark Ingram
Mark Ingram

Reputation: 73605

Detect via javascript whether Silverlight is installed

Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser?

I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silverlight control which is just shown if the Silverlight plugin doesn't load.

Edit: From link provided in accepted answer:

Include Silverlight.js (from Silverlight SDK)

Silverlight.isInstalled("2.0");

Upvotes: 10

Views: 12773

Answers (5)

Domenic
Domenic

Reputation: 112817

Include Silverlight.js (from Silverlight SDK)

Silverlight.isInstalled("4.0")


Resource:

http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx

Upvotes: 11

Hong
Hong

Reputation: 18501

        if (Silverlight.isInstalled("1.0")) {
            try {
                alert("Silverlight Version 1.0 or above is installed");
            }
            catch (err) {
                alert(err.Description);
            }
        }
        else {
            alert("No Silverlight is installed");
        }

from this video.

Silverlight.isInstalled is always true so version string such as "1.0" must be provided to make it useful.

Upvotes: 0

Deano
Deano

Reputation: 2895

Download this script: http://code.msdn.microsoft.com/silverlightjs

And then you can use it like so:

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

Upvotes: 0

Tim Heuer
Tim Heuer

Reputation: 4301

Please actually use the latest script available at http://code.msdn.microsoft.com/silverlightjs for the latest updates. This has several fixes in it.

Upvotes: 9

pcorcoran
pcorcoran

Reputation: 8082

var hasSilverlight = Boolean(window.Silverlight);

var hasSilverlight2 = hasSilverlight && Silverlight.isInstalled('2.0');

Etc....

Upvotes: 0

Related Questions