Sunday, April 10, 2011

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.

No comments: