Finding the SharePoint Site Collection URL on the Client
Little tip - if your client-side code needs to know the URL of the site collection hosting a SharePoint page, have a look at the properties of the _spPageContextInfo object in the HTML source of the page.
This JavaScript object is written into each page, and contains useful information about that page. For my requirement, the _spPageContextInfo.siteServerRelativeUrl property contains the value I needed.
I am Gary Payne, an independent consultant and developer specializing in all matters SharePoint. From developing intranets and business applications, right through to supporting and troubleshooting SharePoint deployments, I am here to help.
My current professional interests include creating visualizations using D3 in SharePoint, and the use of Visual Studio Code for streamlining custom front-end code development.
For more information on my services, please check my web site at www.smallsteps.co.nz
No comments:
Post a Comment