SharePoint: Hide “RibbonRow” and “SuiteBar” From Anonymous Users

For public facing SharePoint sites most of the time people don’t want to show SharePoint “Suitebar” and “RibbonRow” for Antonymous Users.

https://hpksanje.files.wordpress.com/2014/09/1_thumb.png?w=483&h=149

So here is how you can hide SharePoint 2013 “suiteBar” for anonymous users.

  1. Open the master page (default Master and the Home Page Master) using SharePoint Designer. Before you edit your master page take a backup copy 

https://hpksanje.files.wordpress.com/2014/09/image_thumb.png?w=201&h=325 

2. Select your master page -> right click –>Click on  “check out”

https://hpksanje.files.wordpress.com/2014/09/image_thumb1.png?w=647&h=165

https://hpksanje.files.wordpress.com/2014/09/image_thumb2.png?w=473&h=413

3. Select the master page again -> right click –> Click on “edit file in advanced mode”

https://hpksanje.files.wordpress.com/2014/09/image_thumb3.png?w=670&h=409

4. Find the <div id=”suiteBar” class=”ms-dialogHidden noindex”> code block

https://hpksanje.files.wordpress.com/2014/09/image_thumb4.png?w=1006&h=614

5. Now change <div id=”suiteBar” class=”ms-dialogHidden noindex”>  to <div id=”suiteBar” class=”ms-dialogHidden noindex” style=”display:none”>

https://hpksanje.files.wordpress.com/2014/09/image_thumb5.png?w=527&h=68 

 

This will hide the “suitebar” for all users including login users. But we need to enable suite bar for login users. To do that insert below script block right after the above </div> tag

6.Right click on <div id=”suiteBar” class=”ms-dialogHidden noindex”>  to <div id=”suiteBar” class=”ms-dialogHidden noindex” style=”display:none”> code block and click on “Select Tag”

https://hpksanje.files.wordpress.com/2014/09/image_thumb6.png?w=327&h=286 

https://hpksanje.files.wordpress.com/2014/10/suitebar_new_thumb.png?w=711&h=564

7. insert below script block right after the selected section

<!-- My Custom Code -->
<SharePoint:SPSecurityTrimmedControl ID="HideSuiteBar" runat="server" PermissionsString="ManageWeb">
<script type="text/jscript">
document.getElementById("suiteBar").style.display = "block";
</script>
</SharePoint:SPSecurityTrimmedControl>
<!-- -->

https://hpksanje.files.wordpress.com/2014/10/hide_suitebar_new_thumb.png?w=712&h=122

 

This will hide SharePoint “SuiteBar” for Anonymous users.

https://hpksanje.files.wordpress.com/2014/09/snaghtml2c8c40e4_thumb.png?w=862&h=186

Now we have to hide SharePoint “Ribbon Row”

8.Go to your master page. find  <div id=”s4-ribbonrow” style=”height: 35px; display: inherit !important;”> code block.

https://hpksanje.files.wordpress.com/2014/09/image_thumb8.png?w=776&h=409

9. Change <div id=”s4-ribbonrow”> to <div id=”s4-ribbonrow” style=” display:none”>

https://hpksanje.files.wordpress.com/2014/09/image_thumb9.png?w=615&h=124

10. Right click on <div id=”s4-ribbonrow” style=” display:none”> code block -> click on “Select Tag”

https://hpksanje.files.wordpress.com/2014/09/image_thumb10.png?w=419&h=501 

https://hpksanje.files.wordpress.com/2014/09/image_thumb11.png?w=875&h=576

11. Insert below script block right after the above selected </div> tag. (at the end of the Selected Tag)

<!-- My Custom Code -->
<SharePoint:SPSecurityTrimmedControl ID="HideRibbonRow" runat="server" PermissionsString="ManageWeb">
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "block";
</script>
</SharePoint:SPSecurityTrimmedControl>
<!-- -->

https://hpksanje.files.wordpress.com/2014/10/hide_s4_ribbon_new_thumb.png?w=721&h=111

 

12. After inserting above code block , your page will look like below screenshot.

https://hpksanje.files.wordpress.com/2014/10/s4_ribbon_new_thumb.png?w=768&h=472

 

13. “Save” your changes and “Check In” the “Master Page”.

14. This is the final output / View for “anonymous” users.

https://hpksanje.files.wordpress.com/2014/09/snaghtml3e1597c_thumb.png?w=848&h=180

Note :

You have to “Deactivate”Minimal Download Strategy” feature from “Manage Site Features” to take effect all these changes.

https://hpksanje.files.wordpress.com/2014/10/site_features_thumb.png?w=279&h=185

https://hpksanje.files.wordpress.com/2014/10/minimaldownloadstrategy_thumb.png?w=708&h=106

You can use below url to login to your site.because now you can’t see “Sign in” Link on your pages.

http://SiteUrl/_windows/default.aspx

Happy Coding