This class is very helpful while working with SharePoint using JavaScript. This class contains different properties related to current context of a SharePoint page.
How to access:
Example: You can access different properties of _spPageContextInfo class on any SharePoint page as below:
Below are some properties that we can access on SharePoint page:
How to access:
var propertyValue = _spPageContextInfo.propertyNameExample: You can access different properties of _spPageContextInfo class on any SharePoint page as below:
<script type="text/javascript">
var weburl = _spPageContextInfo.webServerRelativeUrl</script>Below are some properties that we can access on SharePoint page:
alertsEnabled
|
true
|
allowSilverlightPrompt
|
"True"
|
clientServerTimeDelta
|
-2595
|
crossDomainPhotosEnabled
|
false
|
currentCultureName
|
"en-US"
|
currentLanguage
|
1033
|
webPermMasks
Hiigh
Low
|
Two 32-bit integers - indicating permissions
a user has
|
currentUICultureName
|
"en-US"
|
isAppWeb
|
False
|
layoutsUrl
|
"_layouts/15"
|
pageItemId
|
1
|
pageListId
|
"{172916e0-cb50-4eac-9d31-80658f35cfb9}"
|
pagePersonalizationScope
|
1
|
serverRequestPath
|
"/kum/site1/Documents/sample.aspx"
|
siteAbsoluteUrl
|
"https://test.com/kum/site1"
|
siteClientTag
|
"0$$15.0.5023.1000"
|
siteServerRelativeUrl
|
"/kum/site1"
|
systemUser
|
"test\pkum"
|
tenantAppVersion
|
"0"
|
userId
|
21
|
webAbsoluteUrl
|
"https://test.com/kum/site1"
|
webLanguage
|
1033
|
webLogoUrl
|
"/_layouts/15/ /logo.png"
|
webServerRelativeUrl
|
"/Audit/adc"
|
webTemplate
|
"10442"
|
webTitle
|
TEST
|
webUIVersion
|
15
|