Get Current SharePoint site Url using SpServices in Content Editor Web Part

Get Current Url of the SharePoint Site using SpServices in Content Editor Web Part

Step 1: Kindly follow my intital post to understand how java script can be used in Content Editor Web Part.

Step 2: Within Content Editor Web Part insert this code


<html>
<head>
<SCRIPT type=text/javascript src="/mysites/myDocLibrary/JsFiles/jquery-1.4.2.min.js"></SCRIPT>
<SCRIPT type=text/javascript src="/mysites/myDocLibrary/JsFiles/JsFiles/jquery.SPServices-0.5.6.min.js"></SCRIPT>
<SCRIPT type=text/javascript>
      
            var thisSite = $().SPServices.SPGetCurrentSite();
           //alert(thisSite);
            document.write("The Current Site is " + thisSite);

</SCRIPT>
</head>

<Body>

</Body>
</html>



Step 3 : To remove the identity that the code was generated from Content Editor Web Part, within the Web Part Setting, Under Appearance, For Chrome Type select "None". Click OK. Click Apply. Publish the Page.

2 comments:

Anonymous said...

Thanks....

Anonymous said...

Thanks.....