Hide SharePoint Top Navigation depending on User Permissions
Published in
1 min readSep 7, 2016
Based on the users SharePoint web permissions, the top navigation (global navigation element) is displayed or will be hidden.
This post addresses two issues with JavaScript:
- How to check a users web permissions in SharePoint
stolen from How to check user permission for the web, list, or SharePoint Item in SharePoint JavaScript Object Model - How to hide an element (in this case the DeltaTopNavigation) using JavaScript. You can modify the CSS using this approach (i.e. DISPLAY: NONE).
The Script
Here is the documentation for SP.PermissionKind Enumeration.
The Implementation
Copy the script source from above into you favourite editor and save it to e.g. the Site Assets library in SharePoint.
Add a CEWP (Content Editor Web Part) to the SharePoint page where you want to run the script and refer with a link to the text file you just created.
That's pretty much it :-)