I have a script that provision site collections under a specific managed path. In these site collections, I have sub webs with page libraries in which I have several different pages with custom javascript code that requires some properties that can be accessed through the _spPageContextInfo
object.
I have two functions that both need to get the current pageItemId
and it's corresponding pageListId
. My problem is that after the page has loaded, none of these two properties are available through the _spPageContextInfo
object.
The strange thing is that I can access them if I pause the loading of the page during page load through a javascript breakpoint on $(document).ready()
, and at that point both properties are available.
Another thing I noticed is that when I've paused the execution, the _spPageContextInfo.siteServerRelativeUrl
is set to "/myManaged/Path/mySubweb"
while when the page is loaded, it is set to "/"
. The same applies to webServerRelativeUrl
,webAbsoluteUrl
and siteAbsoluteUrl
, though they revert back to the root instead of the current site collection and web.
How come that the properties of _spPageContextInfo
changes from these two states, and why aren't pageItemId
and pageListId
available when the page has finished loading? Does this have something to do with the fact that they are created under a managed path?