Archive

Posts Tagged ‘SharePoint JavaScript variables’

How To: Get Current Site Collection URL or site URL in SharePoint 2010

June 21, 2013 2 comments

Guys,

Today, i was looking for ways to get current site collection url from loaded page using JavaScript.

One way is definitely Client Object Model.

But what if you don’t want to use Client OM. You don’t need to write any code to get such URL.

Here are ways:

L_Menu_BaseUrl: This contains URL of site or sub site

L_Menu_LCID: This contains the LCID setting of the current site.

L_Menu_SiteTheme: This contains the theme name of the current site.

_spUserId: This contains the id of the current user.

Ref:

http://vrdmn.blogspot.in/2011/08/javascript-lmenubaseurl-varaible-for.html

http://joshihemant.wordpress.com/2012/05/07/sharepoint-current-site-collection-or-site-url-in-javascript-3/

For, other kind of information, you can use this also:

http://blog.tedpattison.net/Lists/Posts/Post.aspx?ID=9

Happy SharePointing !!!