Skip to main content

Hide the Ribbon in SharePoint 2010

In this post, you learn how to hide the ribbon in SharePoint 2010 by using JavaScript.

About the Ribbon in SharePoint 2010

The SharePoint 2010 ribbon provides a similar user experience as the Microsoft Office client products. The ribbon is a toolbar which appears on top of the page to provide the most commonly used tools, controls, and commands.
The ribbon hierarchy is organized as follows (see Figure 1 and Figure 2):
  • Contextual Tag Group - A contextual tab enables you to provide a set of user interface (UI) controls within a certain context. For example, when you select a table in a document, a set of tabs is displayed to work with the table. When the table is deselected, the contextual tabs are hidden. Contextual tabs with a similar context are organized in a contextual tab group so you can have more than one tab in a group.
  • Tabs – Tabs are used to organize groups of related controls. For example, an Insert tab displays controls that enable you to insert various objects into a document such as files, tables, images, and so forth.
  • Groups – Groups are used to organize related controls such as the font group, styles group, document views group, and so forth.
  • Controls – Buttons, dropdown controls, radio buttons, and other controls that enable you to perform a singular task from the ribbon.
The ribbon can have multiple tabs, tabs can have multiple groups, and group can have multiple controls.
Figure 1. Ribbon tabs and groups
Figure1
Figure 2. Ribbon contextual tab group and controls
Figure2

Hiding the Ribbon in SharePoint 2010

There are multiple ways to hide the ribbon in SharePoint 2010. For example:
  • When publishing a website template (which you should use for public websites), there is a Show/Hide ribbon option under the Site Actions drop-down menu.
  • By using the Security Trimmer control. The Security Trimmer control can be place around the ribbon in Master page to conditionally hide it based on user permissions. The following example shows that a user without manage permissions will not be able to see the ribbon. The PermissionString attribute value can be changed based on the requirement.
<SharePoint:SPSecurityTrimmedControl PermissionsString="ManagePermissions" runat="server">
   <div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
   </div>
</SharePoint:SPSecurityTrimmedControl>
  • By using custom code. JavaScript can be used to show or hide the ribbon in SharePoint 2010.

Creating JavaScript to Hide the Ribbon

In this section, you create a file that contains JavaScript code to show or hide the ribbon while loading a website and webpage. You then create an empty SharePoint 2010 project in Microsoft Visual Studio 2010 and then add the JavaScript file to it. Next, you reference the JavaScript file in the Master page. Finally, you deploy and test the solution.

To create the JavaScript file

  1. Open Notepad.
  2. Add the following JavaScript code to the file and then save it as custom.js.
function ShowRibbon() {
   $("#s4-ribbonrow").show();
   $("#s4-workspace").height($(document).height() - $("#s4-ribbonrow").height() * 2);
}
function HideRibbon() {
   $("#s4-ribbonrow").hide();
   var newHeight = $(document).height();
   if ($.browser.msie) {newHeight = newHeight - 3; }
      $("#s4-workspace").height(newHeight);
}
_spBodyOnLoadFunctionNames.push("HideRibbon");

To create the Empty SharePoint 2010 Project

  1. Start Microsoft Visual Studio 2010.
  2. On the File menu, point to New, and then click Project.
  3. In the New Project dialog window, in the Installed Templates section, click Visual C#, click SharePoint, and then click 2010.
  4. Click Empty SharePoint Project from the project items.
  5. In the Name box, type RibbonDemo and then click OK.
  6. In the SharePoint Customization Wizard, type the local website that you want to use for this exercise (such as http://localhost/SampleWebSite).
  7. For the trust level, select Deploy as a farm solution and then click Finish.
  8. In Solution Explorer, right-click the RibbonDemo project name, point to Add, and then click Existing Item.
  9. Navigate to the JavaScript file you created previously (custom.js) and then click Add.
  10. Open the SharePoint 2010 Designer to the website you specified when you created the Visual Studio project.
  11. Open the website Master page; add the following code, and then save it.
<SharePoint:ScriptLink language="javascript" name="RibbonDemo/jquery-1.6.4.min.js" runat="server"/>
<SharePoint:ScriptLink language="javascript" name="RibbonDemo/custom.js" runat="server"/>

To deploy and test the solution

  1. In Solution Explorer, right-click the RibbonDemo project name, and then click Deploy.
  2. Start Internet Explorer and browse to the website specified previously. The ribbon is hidden when the webpage loads.
This post discussed the SharePoint 2010 ribbon and how to hide it by using JavaScript. You can find more information about the topics discussed here at the following locations.

Comments

Popular posts from this blog

GPT-5.2 Lands in Microsoft 365 Copilot: Smarter Reasoning for Workflows

 Today Microsoft announced that GPT-5.2 is now available in Microsoft 365 Copilot and Copilot Studio , bringing two tuned variants: GPT-5.2 Thinking for deep reasoning and strategic work, and GPT-5.2 Instant for fast writing, translation, and skill-building. In Copilot, the model connects to Work IQ to surface insights across your meetings, emails, and documents—helping you turn scattered information into actionable plans. If you use Copilot Chat or Copilot Studio, you can pick GPT-5.2 from the model selector and try prompts like asking for strategic takeaways from a meeting, building comparative tables of market leaders, or preparing focused talking points for upcoming conversations. Microsoft emphasizes model choice , so teams can select the model that best fits the task while keeping security, compliance, and privacy controls in place. Rollout starts today 11-Dec-2025 for users with a Microsoft 365 Copilot license and will expand over the coming weeks; Microsoft 365 Premium...

Why MFA Matters in Microsoft 365 (and How to Enforce It the Right Way)

If you’re still relying on passwords to protect Microsoft 365, you’re leaving a critical gap in your security. A single phished credential can be enough to access email, files, chats, and sensitive business data. Multi-Factor Authentication (MFA) adds a second verification step—such as an Authenticator prompt, a one-time code, or a security key—so a password alone can’t grant access. As a Microsoft 365 administrator and technology enthusiast, I’ve seen firsthand how implementing MFA dramatically reduces account takeover risk and strengthens organisational security. Who this is for This guide is aimed at Microsoft 365 administrators, IT teams, and business leaders looking for practical steps to bolster tenant security with consistent MFA enforcement. Whether you’re managing a small business or a larger enterprise, the principles here apply to everyone seeking to protect critical business data. The goal: require MFA for interactive sign-ins Enforcing MFA for all interactive use...

6 ways to check SharePoint Usage reports

Introduction SharePoint administrators always want to know which user is accessing any site or site collection extensively and which user has access to the site but not using it. The other site details required are related to traffic, access, edit, etc. The user's behavior changes as per the nature of the site and their working department like project team site, department site, and managerial workspace. Fortunately, Microsoft 365 has given multiple methods to generate or view various reports related to SharePoint usage. We will check all the methods one by one and see how they provide the required results. Several options are available at different parts in SharePoint Site or Admin Center where the Administrator can check status or create reports. Method-1. Check Site Usage in Site Contents Page. The Site contents page shows the analytics data like their unique visitors, total site visits, average time spent by the user, etc. The report can be generated for multiple days like 7, 3...