Add this code into the display form in SharePoint designer
<script type="text/javascript">//
function ResetRibbon() {
try {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
SelectRibbonTab("Ribbon.Read", true);
ribbon.removeChild('Ribbon.ListForm.Display');
ribbon.removeChild('Ribbon.ListForm.Edit');
} catch (e)
{ }
}
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
try
{
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function () {
ResetRibbon();
});
var ribbon = null;
try {
ribbon = pm.get_ribbon();
}
catch (e) { }
if (!ribbon) {
if (typeof (_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
}
else {
ResetRibbon();
}
},
"sp.ribbon.js");
}catch(e)
{}
// </script>
<script type="text/javascript">
function ResetRibbon() {
try {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
SelectRibbonTab("Ribbon.Read", true);
ribbon.removeChild("Ribbon.ListForm.Display");
ribbon.removeChild("Ribbon.ListForm.Edit");
} catch (e)
{ }
}
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
try {
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function () {
ResetRibbon();
});
var ribbon = null;
try {
ribbon = pm.get_ribbon();
}
catch (e) { }
if (!ribbon) {
if (typeof (_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
}
else {
ResetRibbon();
}
} catch (e)
{ }
}, "sp.ribbon.js");
</script>
If you want to keep the display tab up (for workflow approvals, remove this line:
ribbon.removeChild('Ribbon.ListForm.Display');
-------------------------------------------------------------------------------------
Another way would be to remove it using CSS
<style>
#suiteBar, #ms-designer-ribbon {
display: none;
}
</style>
--------------------------------------------------------------------------------------
Source: https://social.technet.microsoft.com/Forums/office/en-US/93780f44-80ff-46b5-a80f-bc4ef09e4113/how-to-remove-ribbon-and-sites-bar-on-a-particular-site-page-sharepoint-365?forum=sharepointgeneral
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.