0

I have made a site in SharePoint 2013 and different users in my sites like who can view, visit, edit or has full control of the site.

Now for some users I want to hide the browse and page tab from the navigation bar. There are many links available but not working from me.

Can somebody give me brief technical details as to how this could be done? Moreover how can I hide settings link in my ribbon for some users?

3

Create a group which contains users who cant see page and browse buttons in the ribbon or vice versa,

The Below function will hide the browse and page tab from the ribbon

function HideBrowseAndPage() {
var SPGroupName = "YourGroupName";
var clientContext = new SP.ClientContext.get_current();
var currentUser = clientContext.get_web().get_currentUser();
clientContext.load(currentUser);
var userGroups = currentUser.get_groups();
clientContext.load(userGroups);
clientContext.executeQueryAsync(function () {
    var groupsEnumerator = userGroups.getEnumerator();
    while (groupsEnumerator.moveNext()) {
        var group = groupsEnumerator.get_current();
        if (group.get_title().toUpperCase().contains(SPGroupName)) {                
           $(".ms-cui-tts").hide();
            break;
        }
    }
}, OnQueryFailed);
}
function OnQueryFailed() {}

Note: Use this code in your Master page.

2
  1. Create JavaScript or CSS code that hides the items from the ribbon
  2. Place that code inside Script Editor Web Part
  3. Use Audience targeting in web part properties to only "display" that web part to specific users (=to those from which you wish to hide the ribbon items)
  • 1
    This will work for a specific page right ? – user51831 Jun 16 '16 at 7:13
  • Yes, this will only affect the page on which you add the SEWP. – Jussi Palo Jun 16 '16 at 9:31

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.