SharePoint Hidden Gems - _spPageContextInfo

In SharePoint Sites, it has lot of built in controls that can generate the number of dynamic scripts required for site. That enables the user to interact with the browser for some basic client operations.

Open the browser, then navigate to the page and view the source of the page. Then search for “_spPageContentInfo”.

This will show you the four or five lines of JavaScript variables with values. Actually “_spPageContentInfo” is the JavaScript key value pair array variable dynamically generated by the SharePoint OOTB control.

The following table shows you the key value pair of that array.

Variable Value Description
webServerRelativeUrl "\u002f" Web Server Relative URL of the Site
webAbsoluteUrl "https:\u002f\u002fsharepointsite.sharepoint.com" Returns the web absolutue url of the site
siteAbsoluteUrl "https:\u002f\u002fsharepointsite.sharepoint.com" Returns the site collection absolutue url of the site
serverRequestPath "\u002f_layouts\u002f15\u002fstart.aspx" Returns the url of the page from requested
layoutsUrl "_layouts\u002f15" Layouts URL for the SharePoint Version
webTitle "Sharepoint Team Site" Current Website Title
webTemplate "1" Returns the Template order
tenantAppVersion "206692644" Returns the tenant app versionif the site if hosted in cloud
isAppWeb FALSE Returns the booleanweather the web is app catalog website
webLogoUrl "_layouts\u002f15\u002fimages\u002fsiteicon.png" Return the current website logo url
webLanguage 1033 Returns the web language code
currentLanguage 1033 Returns the current language code based on website or User
currentUICultureName "en-US" Returns the current Ui culture code
currentCultureName "en-US" Returns the current culture code
clientServerTimeDelta "new Date("2015-04-16T15:41:31.9605851Z") - new Date() Returns the time
updateFormDigestPageLoaded "new Date("2015-04-16T15:41:31.9605851Z") Retruns the time of page requested
siteClientTag "0$$16.0.3912.1225" Returns the Site Client Tag. I think it returns partially the version of installed sharepoint
crossDomainPhotosEnabled true, Returns the booleanweather the cross domain photos are allowed
webUIVersion 15 Returns the UI version number
webPermMasks {High:2147483647,Low:4294705151} Returns the permission code
pagePersonalizationScope 1, Retruns the scope number of page personalizationweather it is allowed
userId 12, Retruns the current login user id
userLoginName "[email protected]" Returns the current user login name
systemUserKey "i:0h.f|membership|[email protected]" Returns the userkey in the format of claims mode authentication format
alertsEnabled TRUE Retruns the booleanweather the alerts are enable for the site
siteServerRelativeUrl "\u002f" Returns the site collection relative url
allowSilverlightPrompt 'True' Returns the booleanweather to show the silverlight prompt

The variables can be accessed by in client side by using _spPageContextInfo.variablename.