Posts

Showing posts from October, 2014

Get Current SharePoint Site Url using javascript

<script> var clientContext; var website; function GetSiteUrl()   {    clientContext = SP.ClientContext.get_current();    website = clientContext.get_web();    clientContext.load(website);     clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);   } function onRequestSucceeded() { alert(website.get_url()); } function onRequestFailed(sender, args) { alert('Error: ' + args.get_message()); } </script> <a href='javascript:GetSiteUrl();'>Get URL</a>