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.
ribbon.removeChild('Ribbon.ListForm.Edit');
}
SP.SOD.executeOrDelayUntilScriptLoaded(function() {
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function() {
hideEditRibbon();
});
var ribbon = null;
try {
ribbon = pm.get_ribbon();
}
catch (e) { }
if (!ribbon) {
if (typeof(_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
}
else {
hideEditRibbon();
}
},
"sp.ribbon.js");
Just add this code to a page using the content editor web part and it will work.
via Buzz Blog http://paulbuzzblog.wordpress.com/2012/11/23/how-to-hide-the-sharepoint-ribbon/
Paul is a an expert SharePoint and Project Server developer and is responsible for designing and implementing custom solutions on client systems using the latest SharePoint and .NET technologies.
Paul has extensive experience with SharePoint systems across all sizes of implementation, ranging from small to large farms and has an excellent understanding of all the elements of SharePoint. This article has been cross posted from paulbuzzblog.wordpress.com (original article) |
Categories: Paul Busby, Work
Development, Project Server, SharePoint
Awesome Paul it took me ages to find a good example of how to do this