I have an issue with editing a Sharepoint page.
I have to check whether Silverlight is installed in the user's system which is done by a Javascript function, but the issue I'm getting after implementing this is I'm unable to edit the page and the items in the Ribbon are disabled.

Here is the code:

This is what I have

<script language="javascript" type="text/javascript">

    function IsSLInstalled()    
    {
        var isSilverlightInstalled = false;
        var slControl;
        //check on IE
        try
        {
            slControl = new ActiveXObject('AgControl.AgControl');
            isSilverlightInstalled = true;
        }
        catch (e) 
        {
            //either not installed or not IE. Check Firefox
            if (navigator.plugins["Silverlight Plug-In"]) 
            {
                isSilverlightInstalled = true;
            }
        }
        if (isSilverlightInstalled == true)
        {
            document.getElementById('<%= ibtnHelp.ClientID %>').style.visibility = "visible";
        }
        else
         {
            document.getElementById('<%= ibtnHelp.ClientID %>').style.visibility = "hidden";
        }
    }
    window.onload = IsSLInstalled;
</script>
link|improve this question
we definitely need to take a look at your js and the way you added it to the page – Ivan Padabed Sep 14 '11 at 11:20
@Mohammad: I've edited your post for you to include the code. – Kit Menke Sep 14 '11 at 13:49
Thanks Kit Menke.. – Mohammad Shabbir Ahmed Sep 15 '11 at 8:53
feedback

1 Answer

up vote 1 down vote accepted

Please use _spBodyOnLoadFunctionNames.push("IsSLInstalled");

Do not use window.onload = IsSLInstalled;

Bye

link|improve this answer
Thanks a lot.. it worked perfectly!! – Mohammad Shabbir Ahmed Sep 15 '11 at 8:52
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.