October 29, 2009

Disable the Name ActiveX Control on public facing SharePoint Sites

You may have often seen this popup come up on a public facing site that you are browsing too.  It is because the SharePoint Server is trying to load the control, and it is not in the list of pre-approved controls in IE7.  The control is used to display presence information in a SharePoint site.  This shows up as the small circle presence indicator tied into Windows Live Messenger.

I was getting this popup on this blog site, so I thought I would share how we deal with it.  Since this is on a server that only serves public-facing content, I decided to follow the server based solution outlined below.

This was adapted from a Microsoft SharePoint Blog article by Michael Gannotti and makes reference to Microsoft Support KB article 931509:

http://sharepoint.microsoft.com/blogs/mikeg/Lists/Posts/Post.aspx?ID=191

http://support.microsoft.com/kb/931509

A recurring issue with public facing SharePoint sites is the running of the Name ActiveX control (Name.dll). When you browse to the SharePoint site, you receive the following message in the Information bar in Internet Explorer 7 (and most likely on Internet Explorer 8 as well):

The Web site wants to run the following add-on: 'Name ActiveX Control' from 'Microsoft Corporation'. If you trust the Web site and the add-on and want to allow it to run, click here...

To remove this message the ActiveX control need to be prevented from trying to load. There is a Microsoft Support article (KB 931509) written on this but this solution caused JavaScript errors on the server that it was implemented on and did not prevent the message from appearing.

Two ways of dealing with this have since been developed one that is server based and another that is specific to a master page. If all sites on a server require this then use the Server Based Solution but if you need this on only specific sits or even a specific master page use the Master Page Solution.

The issue that causes the Name ActiveX Control to run is the function called ProcessImn() that is within the INIT.js file. This call needs to be removed to prevent the browser from trying to load the ActiveX control.

Server Based Solution

This solution is a quick modification to the INIT.js file on the host server. WARNING - doing this change will affect every SharePoint site on that server regardless of application space (as the INIT.js is shared by all SharePoint applications). Only do this modification if all sites need this disabled.

You will need to locate the INIT.js file on the server you wish to modify. It should be located in the Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Layouts
\1033 folder.

It is always a good idea to make a back-up of the file in case some goes wrong while you are making modifications. There is a function ProcessDefaultOnLoad(onLoadFunctionNames) that makes a call to the ProcessImn() function. The modification is to comment out this call so that the function is not called thereby preventing the loading of the ActiveX control.

Open the INIT.js file in Notepad and then search for:

ProcessImn();

Once you found it comment it out so that it looks something like this:

//ProcessImn();

Save the file and the request to run the ActiveX control should now be gone.

Master Page Solution

This solution will disable the request to run the ActiveX control on a specific master page thereby allowing a public facing master and non-public master pages to coexist on the same server. The only drawback is this modification needs to be placed on all master pages that require it.

For this solution you need to place the following script block within the BODY tag just after the <WebPartPages:SPWebPartManager runat="server"/> tag. This supersedes the same function that is within the INIT.js file and the ProcessImn() is commented out preventing the call.

<body class="body" onload="javascript:_spBodyOnLoadWrapper();">

<WebPartPages:SPWebPartManager runat="server"/>

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

//This is to prevent the Name ActiveX Control from being loaded.
function ProcessDefaultOnLoad(onLoadFunctionNames)

{
ProcessPNGImages();
UpdateAccessibilityUI();
//ProcessImn();
for (var i=0; i < onLoadFunctionNames.length; i++)
{
var expr="if(typeof("+onLoadFunctionNames[i]+")=='function'){"+onLoadFunctionNames[i]+"();}";
eval(expr);
}
if (typeof(_spUseDefaultFocus)!="undefined")
DefaultFocus();
}

</script>