We have a custom master page and intend to show current logged in username. I can find quite a few solutions but they require server call either with REST API or CSOM.

Is there a way to show the currently logged in user name in master page without any server call?

  • I am on SharePoint Online and there you can use _spPageContextInfo.userDisplayName. Not sure though whether userDisplayName property is available in on premises. Sep 11, 2017 at 11:20
  • @NadeemYousuf: I am on premise 2013. The code '_spPageContextInfo.userDisplayName' does not work for me.
    – Naveen
    Sep 11, 2017 at 11:35
  • Then you should perhaps get the display name using the technique mentioned by @Tiago Sep 11, 2017 at 11:40

1 Answer 1


In order to display stuff without querying the server, you will have to use objects that are already available in the context of the page.

you have for example the user id, but not the user full name. perhaps there are other objects you can look for.


an alternative is of course looking inside the DOM, as you already have the user menu on the top right with the user's name in there

enter image description here


$(".ms-welcome-root a").contents().get(0).nodeValue
  • Seems like this is the only way, at least on premise 2013. Thanks.
    – Naveen
    Sep 12, 2017 at 5:18

Your Answer

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

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