get Current SPSite


/ Published in: JavaScript
Save to your folder(s)

without trailing slash


Copy this code and paste it in your HTML
  1. function getCurrentSpSite() {
  2. var pageUrl= window.location.href;
  3. var protocol = pageUrl.split("/")[0];
  4. var tempFarm= pageUrl.split("//")[1];
  5. var farm = tempFarm.split("/")[0];
  6. return protocol +"//" + farm + L_Menu_BaseUrl ;
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.