1

In SPFx/Typescript we can use this.context.pageContext.legacyPageContext to get the old _spPageContextInfo. But how can I get hold of this if I am just working in the browser console on a modern page (i.e. without Typescript or SPFx)?

rlv-dan
  • 342
  • 3
  • 15

1 Answers1

3

This should work:

window.spModuleLoader._bundledComponents["b6917cb1-93a0-4b97-a84d-7cf49975d4ec"].PageManager._instance.pageContext.legacyPageContext

But I'd recommend adding an application customizer that defines all the required context variables globally in your own namespace.

Dmitry Kozlov
  • 1,498
  • 8
  • 13
  • 1
    Thanks! Had to look up the GUID. For anyone else curious: The "modern" pages are delivered by using the Site Pages web scoped feature (B6917CB1-93A0-4B97-A84D-7CF49975D4EC) – rlv-dan Aug 06 '19 at 06:04