Wednesday, December 14, 2011

Sharepoint 2010 - "The current page has been customized from its template. Revert to template. "

This is the second time I've run into this annoying error, so I decided to post the solution here so I will remember it the next time.  I got from The Google last time it happened, so I don't claim this as my own, but it works quite nicely.  This happens after you modify a non-publishing site.  The following code can be posted into the Head of v4.master file.  This will hide the bar when it displays this message.  Hope this helps some other people, and hopefully Microsoft fixes this "feature" soon.



<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('current page has been customized from its template.') > 0){
                    statusbarContainer.style.display = 'none';
                }else{
                    statusbarContainer.style.display = 'inline';
                }
            }
        }
    }
</script>

No comments:

Post a Comment