Hiding status bar messages in SharePoint 2010
Often times, we may need to make changes to master page files in a SharePoint site to customize a layout, add styling, CSS, custom web parts, etc. When the site was created using a default site template and content type, and your changes deviate from this, as you save you’ll be prompted with a warning basically saying “you do realize this is different from the original template, right?”. However, when you open the page in a browser, your users will have a status bar at the top with an option to “Revert to Site Template”, which will re-render the page and possibly remove the changes you’ve made, giving them the idea they weren’t done or done right.
This is an easy solution, which @ranaictiu mentioned in his blog post here.
Basically, open the site in SPD and open up the V4.master file in Master Pages. Locate the following section of code:
<div id="s4-statusbarcontainer">
<div id="pageStatusBar" class="s4-status-s1"></div>
</div>
add the following style attribute to the first DIV:
<div id="s4-statusbarcontainer" style="display: none">
<div id="pageStatusBar">
</div>
</div>
This will hide all status bar notifications going forward. Now, if you want to show some status bar messages but just hide others a script like the following would handle that (put it in the <head> area of the master page):
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(hideWarning, "sp.js");
function hideWarning(){
var statusBarContainer = document.getElementById('s4-statusbarcontainer');
if(statusBarContainer != null){
var messageSpan = document.getElementById('status_1_body');
if(messageSpan != null){
if(messageSpan.innerHTML.indexOf('The current page has been customized from its template.') == -1
statusBarContainer.style.display = 'inline';
}
}
}
</script>
Hope this helps!
2 thoughts on “Hiding status bar messages in SharePoint 2010”
well i guess it’s empty at the start, not display none. what i’m experiencing is with a Data Form Web Part with pagination …. every time I click an arrow, that box adds a message. So I attached a version of your script to the onclick to reset it to display none, and that seems to have done the trick.
i think that div is already display:none — every time a status message fires, it turns it back on (and apparently increments its height).
Comments are closed.