Detect via javascript whether Silverlight is installed

旧时模样 提交于 2019-12-17 20:19:10

问题


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");

回答1:


Include Silverlight.js (from Silverlight SDK)

Silverlight.isInstalled("4.0")


Resource:

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




回答2:


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




回答3:


var hasSilverlight = Boolean(window.Silverlight);

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

Etc....




回答4:


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"); }




回答5:


        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.



来源:https://stackoverflow.com/questions/119980/detect-via-javascript-whether-silverlight-is-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!