SharePoint – IE8 standards mode causes trouble in SharePoint

Running SharePoint on IE8 – JavaScript errors when using the rich text editor.

‘null’ is null or not an object – in form.js

clip_image002

 

The debugger shows that the SharePoint javascript code was trying to call:

document.getElementById("ctl00_PlaceHolderMain_EditModePanel3_ctl04_ctl00_RichHtmlField_displayContent_LTR")

The id of that element is actually: ctl00_PlaceHolderMain_EditModePanel3_ctl04_ctl00_RichHtmlField_displayContent_ltr

In IE7’s incorrect JavaScript behavior – it finds the element and returns it.

In IE8’s correct JavaScript behavior – it doesn’t find the element and returns null.  -> Error!

---

IE8 will attempt to use IE7 compatibility mode when accessing intranet sites.  It will use IE8 standards mode when accessing public internet sites.

This means that when accessing your SharePoint site via the extranet URL – http://sharepoint.company.com/ you will get this error, but accessing it internally – http://sharepoint/ will be OK.

----

Ways to fix this (easy to hard):


  1. Custom Header in web.config (site-wide)
    http://msdn.microsoft.com/en-us/library/cc817572.aspx
  2. Meta tag in master page (specify per masterpage)
    http://msdn.microsoft.com/en-us/library/cc817574.aspx 
  3. Use Telerik’s RadEditor Lite – free alternative
    http://www.telerik.com/products/aspnet-ajax/sharepoint.aspx
  4. Wait for MS SharePoint hotfix
    UPDATE: waiting for MOSS service pack 2 - which contains IE8 support
  5. UPDATE: tell your editors to run SharePoint in compatibility mode

So you want to be a SharePoint architect

Someone asked what is a SharePoint architect:

http://stackoverflow.com/questions/654318/what-knowledge-should-a-software-architect-have-about-sharepoint/

Here’re my thoughts collected and reposted (and most likely incomplete):

 

Skills such as list, documents, workflow, permissions... are a bit too basic and are requirement for a SharePoint DEVELOPER.

I'd argue that perhaps site (and site structure) is an area that would fall under the architect's plate.

There are more areas that a SharePoint architect can help with:

  • Capacity planning - running multiple servers in a farm. Scalability and other magic words.

  • Knowing the capabilities and business scenarios of using SharePoint - this is a very common one.
    The manager asks: what can SharePoint do for me? The developer asks: well, what do you want it to do. The manager then asks: well, I don't know what it can do for me so how do I know what do I want it to do?

  • Closely related to SharePoint capabilities are the various licensing costs related to each component.

  • As well as familiarity with development and customization costs. Take the same project time that would have taken in ASP.NET, then multiply it by a large coefficient, and then add an additional constant.

  • And closely related to what-can-it-do, and how-much-does-it-cost, is the all important question of Return-Of-Investment. All hail supreme ROI!

  • SharePoint deployment can be a massive issue and a lot of pain.

  • SharePoint upgrade from v2 (MOSS 2003) to v3 (MOSS 2007). We should be seeing a new version of SharePoint in 2010(?). Well soon after the next version of Office goes out the door. So past upgrade experiences may be useful.

  • Knowledge of 3rd party webparts. I believe a SharePoint architect should be able to give you at least 5 webparts that they've tried from CodePlex and tell you what they think about them. These are free and easy to grab and play at your own leisure.

  • Some knowledge of commercial webparts. Because they are still cheaper than writing your own.

  • Have at least 5 SharePoint blogs that they follow religiously (know the community). If not having their own SharePoint blog (give back to the community).

  • If they are on StackOverflow they must try to answer SharePoint questions (such as this one).

  • Attend local SharePoint usergroups. I think communities are a huge deal. Especially what you'd learn from talking with people directly and learning what they are doing with their SharePoint installation. You may just surprise yourself.

  • Experiences with SharePoint Integration - this comes in two equally important flavours - both from SharePoint accessing existing systems (business catalogs, webparts, etc), as well as other systems accessing SharePoint content via webservice or API.

  • In addition, SharePoint works with (or works well) with Office, OCS, reporting services, performance point, project server.

  • SharePoint hosting arrangements - Microsoft SharePoint online services can be a popular and cheaper option to start using SharePoint. It can be hosted inhouse, or with a 3rd party company. Knowing the options is always useful.

  • Must have read SharePoint code using reflector (and preferably still having hair).

I think it takes at least a couple of years to be a SharePoint architect (your mileage may differ). Your .NET architects need to want-to-be a SharePoint architect, otherwise I agree with other's summaries before me - find someone who already is a SharePoint architect.

SharePoint – Name ActiveX Control error.

image

 

This error pops up on SharePoint MOSS publishing websites that are in the Internet security zone for IE browsers.

This is because the core.js file wants to use ActiveX control “name.dll”, this ActiveX control is responsible for the presence information for SharePoint.

In the Internet security zone, IE pops this question to the user to ask them whether they want the ActiveX to run.

In development

For developers, if you have accidentally clicked “Yes Allow it to run”, then you won’t see this error and it can hinder your debugging of your public SharePoint site.

This is a RegEdit fix to get rid of this key to see name.dlll ActiveX warning in IE again.

HKCU\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{E18FEC31-2EA1-49A2-A7A6-902DC0D1FF05}

I have been told that some server machines doesn’t seem to have this key.

UPDATE try: HKCU\Software\Microsoft\Windows\CurrentVersion\Ext\Stats\{E18FEC31-2EA1-49A2-A7A6-902DC0D1FF05}

Fix


  1. MS has a KB article that shows you a broken way of fixing this.  It doesn’t work.
  2. We’ve found two other ways that are slightly better, one way is to override the JavaScript function that calls this – you have to be careful of the timing of which events are called first.
  3. The other way is to implement a HTTP output module to strip the reference to core.js from the output stream.  This can only be done safely for anonymous users, as core.js contains required JavaScript that is necessary for content editing.

Javascript - jQuery + ASP.NET – post-AJAX events

From jQuery, we get $(document).ready which is wonderful.
From ASP.NET, we get the UpdatePanel control which is fantastic.

 

One of the common problems that people have is regarding how to re-run the scripts after the UpdatePanel ajax update.

Here is one javascript-based solution – I consider these less intrusive than the code-behind solution with ClientScript.

Disclaimer – I learn this from previous projects I’ve worked on with personal experimentation – but I have not since read much documentation.

 

Original:

$(document).ready( function() {
$("a.link").css("border", "1px solid red");
})


The improved:

function setupLinkBorder( parentElement ) {
$("a.link", parentElement).css("border", "1px solid red");
}
$(document).ready( function() {
if (Sys &&
Sys.WebForms &&
Sys.WebForms.PageRequestManager &&
Sys.WebForms.PageRequestManager.getInstance()) {

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function(src,args){
setupLinkBorder(args.get_panelsCreated()); // when UpdatePanel are first loaded
setupLinkBorder(args.get_panelsUpdated()); // when UpdatePanel are loaded via AJAX
});
}
})



  1. Split out the actual script into a separate function
  2. Make sure you have a Sys.WebForms.PageRequestManager.getInstance() object – the code for this part was a bit scary.
  3. Add event handler to handle pageloaded event fired by ASP.NET (which occurs for UpdatePanel update as well)
  4. Rely on the parent element property of jQuery to limit jQuery selector to elements within the updated panel only.  This ensures you don’t fire the jQuery code on elements that are outside of the UpdatePanel – which can be bad.