1

I am trying to find out the title of the current page with SP.js without having to get it from the DOM.

Is there a way to find what Web Parts are on the current page?

1
  • 1
    This seems to be two different questions in one? If so, please divide it into two questions. Commented Mar 24, 2014 at 11:54

1 Answer 1

3

You have two ways:

  1. Use the GetLimitedWebPartManager that give to you access on what web part you have on the current page.
  2. You can use JQuery to find all the div tag that using one of the following css class: ms-WPBody, also ms-webpart-, and also the webpart's id start with a "WebPartWP"

Do some crawling on your DOM and you will find what do you need.

To get the current page title the only way to do that is reading the DOM. That means:

1) by JQuery: var current_title = $(document).attr('title'); 2) standard JS: document.title

2
  • This doesn't do what I was hoping it would, I am trying to get the current page title without crawling the DOM Commented Mar 24, 2014 at 11:31
  • Ok but I read two questions: get document title and get all the current web parts on the page Commented Mar 24, 2014 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.