Skip to main content

Get Site Url from Client Side Scripting

While working on client side scripting, you can generate urls as follows:

Site Collection
window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl;

Sub Site

_spPageContextInfo.webAbsoluteUrl;

QED

Comments