John Liu .NET

View Original

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