SharePoint 2010 compatibility in IE9

SharePoint 2010 compatibility in IE9

SharePoint 2010 is not fully compatible with IE9. To the best of my knowledge this is due to SharePoint’s heavy dependency upon DOM expandos and other features which were available through IE8, but are all removed from IE9. Controls like the Rich TextBox and People Picker tend to render improperly, throw errors on postback, etc. Fortunately, M_Olson posted a JavaScript mod that worked perfectly for me! It looks like this:

function ConvertEntityToSpan(ctx, entity)
{ULSGjk:;    
if(matches[ctx]==null)
	matches[ctx]=new Array();    
var key=entity.getAttribute("Key");    
var displayText=entity.getAttribute("DisplayText");    
var isResolved=entity.getAttribute("IsResolved");    
var description=entity.getAttribute("Description");    
var style='ms-entity-unresolved';    
if(isResolved=='True')
        style='ms-entity-resolved';    
var spandata="";
spandata+="";    
if(PreferContentEditableDiv(ctx))    
{
    if(browseris.safari)        
	{
        spandata+="";        
	}        
	else        
	{
        spandata+="";        
	}    
}    
else    
{
    spandata+="";    
}    
if (browseris.ie8standard)
    spandata+="r";    
if(displayText !='')
    spandata+=STSHtmlEncode(displayText);    
else
    spandata+=STSHtmlEncode(key);    
if (browseris.ie8standard)
    spandata+="rr";    
else    
    spandata+="";    
return spandata;
}
// **** CUSTOM FUNCTION ****
function fixDataInIE9(data)
{    
	if(data.indexOf('') >= 0)    
	{    
		data = data.replace('', '');    
	}    
	return data;
}

Save that as a .js file in your /TEMPLATE/LAYOUTS/1033 path, then reference it at the very bottom of your Master Page, immediately before the two input elements like so:

<script type="text/javascript" src="/_layouts/1033/filename.js"></script>

<input type="text" name="__spText1" title="text" style="display:none;" />
<input type="text" name="__spText2" title="text" style="display:none;" />

Worked like a charm! There are other ways to do this, such as call it from a ScriptLink control, which also works. The key is to load the JavaScript file absolutely last, after all other content has loaded. At least this will give my company the chance to keep using SharePoint 2010 until we can migrate everything to SharePoint 2013.

Comments are closed.