_spPageContextInfo is your new best friend

Posted on 2/20/2013 @ 12:38 PM in #SharePoint by | Feedback | 37356 views

This is something I didn’t cover in my planet of the apps book because it’s intended for another upcoming book ;-)

So, memorize this - _spPageContextInfo, you’ll find it very helpful when writing SP JavaScript code. This is a simple object that you will find on every SharePoint page, and it will have the following useful bits of information on it,

Name

SP2010

SP2013

Example Value

currentLanguage

X

X

1033

pageItemId

X

X

1

pageListId

X

X

Guid

webLanguage

X

X

1033

webServerRelativeUrl

X

X

/

webUIVersion

X

X

4 or 15

alertsEnabled

X

X

False

allowSilverlightPrompt

X

X

False

userId

X

X

9

clientServerTimeDelta

 

X

Time

crossDomainPhotosEnabled

 

X

False

currentCultureName

 

X

en-US

currentUICultureName

 

X

en-US

layoutsUrl

 

X

_layouts/15

pagePersonalizationScope

 

X

1

serverRequestPath

 

X

/SitePages/Home.aspx

siteAbsoluteUrl

 

X

http://sp

siteClientTag

 

X

0$$15.0.4420.1017

siteServerRelativeUrl

 

X

/

systemUserKey

 

X

1:0).w|<sid>

tenantAppVersion

 

X

0

webAbsoluteUrl

 

X

http://sp

webTemplate

 

X

1

webLogoUrl

 

X

_layouts/15/images/siteicon.png

webPermMasks

 

X

Object with properties
High & Low

webTitle

 

X

Test

 

Enjoy! :)

Sound off but keep it civil:

Older comments..


On 2/20/2013 1:21:01 PM Matthew Bramer said ..
http://blog.tedpattison.net/Lists/Posts/Post.aspx?ID=9

Pretty nice summary for 2010 and some of the caveats that you don't cover.

Cheers,


Matthew