is it possible to create a link on a page to a library within the same page. So for example, I have a small list of 8 categories on my page, when i click on the first category "Governance" I would like to be taken to the Governance web part (library) on the same page. Am I making my self clear? thanks, Colin


You could solve this with a relative url, so if it's a list you do this:


or if it's a library:


This is the simple solution, and will only work if you are located on the "top" of your SPWeb. If your question was about codebehind (C#) then the URL can be resolved.
The URL can also be resolved with Client Object Model in JavaScript, like this:

var ctx = new SP.ClientContext();
var site = ctx.get_site();
var list = ctx.get_web().get_lists().getByTitle('UrlTest');
ctx.executeQueryAsync(function() {a=site
  console.log(site.get_url(), list.get_defaultViewUrl());

here site is not necessary, as list.get_defaultViewUrl() will return a root relative URL (starting from /), but I decided to add it to show how to get absolute URL.

  • it is mylibrary/ , however, I am developing the front end and am not a programmer. So perhaps this is too deep for me. I am trying to build a Table of Contents for my Library parts on the same site page. So when they click on Chapter 1, it will take them to the Library, or book mark. – Colin Oct 24 '12 at 18:05
  • So adding a link manually in a content editor web part or similar should do the trick? – eirikb Oct 24 '12 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.