Function

$().SPServices.SPGetCurrentSite

Certification

Certified for SharePoint 2007 Certified for SharePoint 2010

Functionality

This utility function, which is also publicly available, simply returns the current site's URL. It mirrors the functionality of the WebUrlFromPageUrl operation.

Note: There is a bug in the versions 2013.01, 2013.02, and 2014.01 where only the relative path ("/") is returned rather than the full path ("http://servername/sitename"). This causes problems in the root site for $().SPServices.SPGetCurrentSite and $().SPServices.SPGetCurrentUser.

Syntax

$().SPServices.SPGetCurrentSite();

Example

var thisSite = $().SPServices.SPGetCurrentSite();

Available Options

None

Returns

The current site URL as a string. For example, if the current page is:

http://servername/sitename/Pages/default.aspx
or
http://servername/sitename/Shared%20Documents/Forms/EditForm.aspx
or
http://servername/sitename/Lists/Calendar/NewForm.aspx

the function will return:

http://servername/sitename

Last edited Oct 16, 2014 at 10:52 PM by sympmarc, version 9

Comments

Khushisshaikh Jul 10, 2014 at 8:12 PM 
Is there any function that can provide the Users data of the given user? instead of current user

Regards
Khushi