How can I hide the Office 365 / SharePoint 2013 suite and ribbon bars for anonymous users?

Office365 SP2013 SP2013 Foundation

Info: SharePoint Designer is required in order to accomplish the steps described in this article. If you need to download it please follow this link

By default the suite and ribbon bars are visible for all users using SharePoint 2013 and Office 365. However, for some sites it could be useful to remove these bars for anonymous users.

spbars.png

Hiding the suite bar

  1. Open you site with SharePoint Designer
  2. Edit the masterpage
    • Sandbox solution: go to All files > _catalogs > masterpages > THEMENAME
    • Farm solution: go to All files > _catalogs > masterpages
  3. Check out and edit in advanced mode the master page you are using
  4. Look for the comment
    <!--SuiteBar start-->
  5. Right before it paste the line bellow
    <Sharepoint:SPSecurityTrimmedControl runat="server" Permissions="ManageWeb">
  6. Look for the comment
    <!--SuiteBar end-->
  7. Just below it paste the code
    </SharePoint:SPSecurityTrimmedControl>

Hiding the ribbon bar

The SPSecurityTrimmedControl applied remove the suite bar but could not be used to remove the ribbon bar because SharePoint uses this one to calculate the scroll on the page.
The ribbon bar has to be hidden using a small script.
  1. Open you site with SharePoint Designer
  2. Edit the masterpage
    • Sandbox solution: go to All files > _catalogs > masterpages > THEMENAME
    • Farm solution: go to All files > _catalogs > masterpages
  3. Check out and edit in advanced mode the master page you are using
  4. Look for the comment
    <!--Ribbon end-->
  5. Right below it paste the script
    • For Office 365
                      <script type="text/javascript">
                        var suitebar = $("#suiteBarDelta");
                        if(suitebar.length<1)
                           $("#s4-ribbonrow").css('display','none');
                      </script>
                      
    • For SharePoint 2013
                          <script type="text/javascript">
                            var suitebar = $("#suiteBar");
                            if(suitebar.length<1)
                               $("#s4-ribbonrow").css('display','none');
                          </script>
                      
The full list of permission values can be found at: https://msdn.microsoft.com/EN-US/library/ms412690
Have more questions? Submit a request

Comments

  • Avatar
    Ddpvanoerle

    Hello João,

    thanks for the instruction.

    One question now: How do I get in for editing the pages?

    Even when I logged in to the main administrator screen, I am not able to get into editing the pages of the site.

    When I click on the button publice site I get the normal site, without the suit bar to log me in.

    I thought the trim was there to give me as a loggedin the entrance to edit the site pages

  • Avatar
    Ddpvanoerle

    I have made a button for "editing public site" See attachement.

    I have put this link in it:

    https://dirkvanoerle1-public.sharepoint.com/_layouts/15/authenticate.aspx?Source=/

    Only with this i can access the editing mode of the site

  • Avatar
    Joao Ferreira

    Hi,

     

    If you hide the suite bar and the ribbon bar, to get the edit options back you have to access to your site using the https version.

  • Avatar
    Adrian Pearson

    Hi Joao,

    Do the above instructions apply to the public website too?

    Clearly, we would not want the Suite Bar to show for anonymous browsers on the public website.

    Or will the Suite Bar automatically disappear when we apply our custom domain name?

    Regards

    Adrian

  • Avatar
    Joao Ferreira

    Hi Adrian,

    Those instructions are valid also for the public website, if you want to hide the bars you have to apply it.

     

    Regards

    ,

     

    João Ferreira

  • Avatar
    Adrian Pearson

    Thanks for the clarification Joao, however, when I follow your instructions they have no effect - my IT person here thinks that I am not editing the correct master page.

    I used this fix  http://support.bind.pt/entries/24005423-Edit-page-properties-on-Public-Facing-web-sites-from-Office-365-2013 before and wonder if that is affecting this second fix?

    Attached is a screen clip, showing the file I am editing.

  • Avatar
    Joao Ferreira

    Hi Adrian,

    You are editing the correct master page but don't forget that you always have to check out the master and then check in and publish the major version, other wise the changes will be only visible for the user that made it.

  • Avatar
    Adrian Pearson

    My IT guy has found a second copy of the masterpage which for some reason isn't showing up in the masterpages list (but is showing up in the All Files list). He reckons that this one is the one that we'll need to edit to make the change. Is there a way for you to check this please before we make any changes? It doesn't look like this theme has been installed correctly?

  • Avatar
    Joao Ferreira

    Hi Adrian,

    The master pages are located under All files ->  _catalogs/masterpages/MetroMadeInHeavenmasters/, the theme includes two masterpages one with side bar and one without it, your site is using the master without side bar.

    Can you please tell me what is the path of the master you found?

  • Avatar
    Adrian Pearson

    I just opened the masterpages folder in the left sidebar in SharePoint Designer (I sent the screen clip) but it seems going via All Files reveals the extra masterpage, even tough it appears to be the same folder. Thanks for the confirmation.

  • Avatar
    Hitesh

    HI Joao

    Is it possible to remove this bar or edit it so I can stick my own links on instead of Office365?

  • Avatar
    Joao Ferreira

    Hi Hitesh,

     

    It is possible but you have to create a custom script to change the bars.

    You can follow this article as a starting point http://academy.bindtuning.com/customize-sharepoint-2013-and-office-365-suite-bar/

     

    My best,

     

    João Ferreira

  • Avatar
    Scott Stafford

    If using the seattle.master, then where would the code go to hide the suite bar?

    Thanks.

  • Avatar
    Anne Coles

    Using the above code, I found the only users able to see the Suite Bar were administrators.  I only wanted anonymous users not to see the Suite Bar on my Public Site so I used this code: 

     

    At start of suite bar <!--SuiteBar start--> add this

    <Sharepoint:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AuthenticatedUsersOnly">

     

    At end of suite bar <!--SuiteBar end--> add this

    /SharePoint:SPSecurityTrimmedControl

     

    I though others might find this useful.

  • Avatar
    John Monkhouse

    This is great, just what I was looking for thanks.

    Is there any way to create a link that will bring the ribbon back so we can edit the page?

Got a question?

If you can't find the answer to your question, you can contact us.
We are here and happy to help.

Powered by Zendesk