Home > CPS, work > How to hide the SharePoint ribbon

How to hide the SharePoint ribbon


Here is a quick post to show you how you can hide the SharePoint ribbon on a page using JavaScript. This was created by one of my colleagues so I am not sure of why the ribbon needed to be hidden but here is how.


function hideEditRibbon() {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
// Set the tab to the “Browse” tab
SelectRibbonTab("Ribbon.Read", true);
// Remove the “Edit” tab from a list from from the ribbon.

SP.SOD.executeOrDelayUntilScriptLoaded(function() {

var pm = SP.Ribbon.PageManager.get_instance();

pm.add_ribbonInited(function() {

var ribbon = null;
try {
ribbon = pm.get_ribbon();
catch (e) { }

if (!ribbon) {
if (typeof(_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
else {


Just add this code to a page using the content editor web part and it will work.

Categories: CPS, work Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: