Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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>
share|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
add comment

1 Answer 1

up vote 1 down vote accepted

Please use _spBodyOnLoadFunctionNames.push("IsSLInstalled");

Do not use window.onload = IsSLInstalled;

Bye

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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