Version detection with Silverlight

后端 未结 6 2112
轮回少年
轮回少年 2020-12-17 19:20

How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of Silverlight currently running on the browser?<

6条回答
  •  佛祖请我去吃肉
    2020-12-17 20:05

    I got this from http://forums.asp.net/p/1135746/1997617.aspx#1997617 which is the same link Stu gave you. I just included the code snippet.

    Silverlight.isInstalled = function(d)
    {
        var c = false, a = null;
        try
        {
            var b = null;
            if(Silverlight.ua.Browser == "MSIE")
                b = new ActiveXObject("AgControl.AgControl");
            else
                if(navigator.plugins["Silverlight Plug-In"])
                {
                    a = document.createElement("div");
                    document.body.appendChild(a);
                    a.innerHTML = '';
                    b = a.childNodes[0]
                }
    
            if(b.IsVersionSupported(d))
                c = true;
            b = null;
            Silverlight.available = true
        }
        catch(e)
        {
            c=false
        }
    
        if(a)
            document.body.removeChild(a);
        return c
    };
    

提交回复
热议问题