SP.Site.url property (sp.js)

Gets the full URL to the root Web site of the site collection, including host name, port number, and path.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

var value = SP.Site.get_url ()

Return value

Type: String

Remarks

This property must not end with a leading forward slash ("/"

REST resource endpoint

Endpoint URI structure

http://<sitecollection>/<site>/_api/site/url

HTTP requests

This resource supports the following HTTP commands:

  • POST

POST syntax

POST http://<sitecollection>/<site>/_api/site/url

GET syntax

GET http://<sitecollection>/<site>/_api/site/url