0

We are using managed navigation for our site collection and subsites and I need to get some info about the pages I'm on using javascript.

I'm familiar with using using executeQueryAsync() in JSOM to send requests for information from the termstore and all, but that isn't what I'm looking for.

I'm used to using _spPageContextInfo to get various useful bits of information about the current page and site. I often just type this into the console to refer to things and check some details that I need to confirm.

I seem to remember that there is some object that is available on every page something like that has words like friendly or segment or something like that in it. I've tried many combinations and search the code, but I'm not finding it. Searching google points out all kinds of things about setting up the navigation and JSOM/REST examples.

Does anybody know about a javascript object/variable that is automatically loaded onto every publishing/managed navigation page and is similar to _spPageContextInfo?

0

Publishing page contains this _spPageContextInfo also, just make sure the script init complete.

 <script type="text/javascript">
        SP.SOD.executeOrDelayUntilScriptLoaded(cunstomLogic, "sp.js");
        function cunstomLogic() {
            console.log(_spPageContextInfo);
        }
    </script>

enter image description here

  • Thank you, but I know _spPageContextInfo. There is something else that I remember finding before that is similar, but offers different information. – Rothrock Oct 31 at 14:45
0

Turns out to be _spFriendlyUrlPageContextInfo. Oddly it is undefined on several of my friendly url pages and defined on others. So I have no idea what is going on with that.

It returns the following properties

  • termId
  • termSetId
  • termStoreId
  • title (not sure which title, but I'm guessing the label for the term)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.