SharePoint 2013 with IE11: L_Menu_BaseUrl and L_Menu_LCID are undefined

In many of my solutions I have used two variables (L_Menu_BaseUrl and L_Menu_LCID) that SharePoint provides trough the master page. Unfortunately these variables disappeared when I updated to IE 11, thus halting all the scripts using them with this error:

‘L_Menu_BaseUrl’ is undefined
‘L_Menu_LCID’ is undefined

This problem is present in SP2013 in IE11 only, and the strange thing is that if you switch on the compatibility mode (or changes the user agent string using F12) the variables return.

As a workaround, put the site in compatibility mode (Tools menu in IE), or insert this code in the top of the script that produces this error:

if(typeof _spPageContextInfo !== "undefined" && _spPageContextInfo.webUIVersion === 15){
	var L_Menu_BaseUrl = L_Menu_BaseUrl || _spPageContextInfo.webServerRelativeUrl !== "/" ? _spPageContextInfo.webServerRelativeUrl : "";
	var L_Menu_LCID = L_Menu_LCID || _spPageContextInfo.currentLanguage.toString();
}

I will update scripts as soon as I can manage.

Alexander

3 thoughts on “SharePoint 2013 with IE11: L_Menu_BaseUrl and L_Menu_LCID are undefined”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.