How to get Relative Path of SharePoint site in JavaScript


Just add following lines and use the variable...

var siteCollectionUrl = _spPageContextInfo.siteServerRelativeUrl;​

var siteWebUrl = _spPageContextInfo.webServerRelativeUrl;

The following blog explained in detail about _spPageContextInfo object.
http://blog.tedpattison.net/Lists/Posts/Post.aspx?ID=9

Comments

Popular posts from this blog

Switch from Classic to Claims Authentication in SharePoint 2010

How to query list data using web service