Tuesday 29th May, 2007

29
May

How to stop your public facing Sharepoint site from loading name.dll

Please, Microsoft, make sure that when you put an article on your Knowledge Base, the solution or workaround you are proposing actually works.

Sharepoint websites insist on loading up an ActiveX control in a file called name.dll in Internet Explorer 7. This is a control that lets you see who in your organisation is logged on or something like that, and obviously it isn’t much use in a public facing web site. In fact it can be a bit of an annoyance to your end users as it pops up the information bar at the top completely unnecessarily.

It took a bit of Googling to find out where it was coming from, and that led me to this Knowledge Base article. The first two solutions, which involve asking your (probably technologically challenged) visitors to do things like putting GUIDs into the Windows registry, are about as helpful as cat poo, but the third — a server side solution — held out a bit of promise so I tried it.

Only to find that it didn’t work.

The offending file which is responsible for loading up name.dll is a Javascript file called init.js, located in

c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ 
    Templates\Layouts\1033

The Knowledge Base article tells you to make a copy of this file, edit out the line that loads in the dll, and change the reference in your master page to point to the new file. However, what it doesn’t tell you is that Sharepoint stubbornly adds a reference to init.js again seemingly from nowhere, thereby rendering this particular fix totally ineffective.

No, you’re going to have to edit init.js itself.

The problem here is that you want to minimise collateral damage. I haven’t a clue where in the bowels of Sharepoint administration they use this thing, or what the other crazy side effects of editing this file might be, and I don’t want to find out the hard way, so with no further ado, here is what I came up with.

The dll is loaded up by a function called EnsureIMNControl, which starts around line 1913. If you change the line in this function which says this:

if (browseris.ie5up && browseris.win32)

to say this:

if (browseris.ie5up && browseris.win32 && 
    (typeof(killNameControl) == 'undefined' || !killNameControl))

then add the following script block into the <head>section of your master page in which you want to kill off the prompt for name.dll:

<script type="text/javascript">    
  var killNameControl = true;  
</script>

it should stop it prompting your users to load name.dll on any pages that are using this particular master page, while leaving it up and running anywhere else that it may be necessary, and creating yet another bit of shrapnel that you have to deploy to all your servers in the farm.