I’ve been building an Intranet site for a client, and that Intranet utilizes the Publishing features of SharePoint. Because the site is being used primarily for displaying web content, the client didn’t want the banner pinned to the top of the page. When I built the Master Page, I simply decided to get rid of the <div id="s4-workspace"/> tag altogether.

This didn’t cause me any problems, really, until I tried to use the Wiki. You know how, in a wiki, when you type the characters “[[” it’s supposed to pop open a little Intellisense menu that shows you the existing pages in the wiki that you can link to? Well, apparently that functionality is dependent on the s4-workspace div! Without that div, I kept getting a javascript error.

Unfortunately, some kind of javascript function was resizing the s4-workspace div so that, by virtue of adding it to my master page, the whole layout was getting sized to dimensions I had no control over. I read this post and discovered a function in the init.js file was firing. I did some digging and discovered it was the FixRibbonAndWorkspaceDimensions function (line 3361 in init.debug.js.)

To fix the problem I needed to write a little javascript to undo what the function was doing to my window, namely, resizing  the s4-workspace div. I solved the problem by simply writing javascript that hides the offending div from view, so it doesn’t matter whether it’s getting resized or not.

I could have written a custom master page just for my Wiki subsites, but I chose instead to modify the page layout upon which all my wiki pages were based: EnterpriseWiki.aspx. I added the s4-workspace div to the page layout like this: <div id="s4-workspace">, then I added the following three lines of javasript as well:

<script language="javascript">
var elmBodyTable=document.getElementById("s4-workspace");
elmBodyTable.style.display="none";
g_setWidthInited=true;
</script>

Such an easy fix took me hours to hunt down. There are probably only about 2 other people out there who will ever run into this problem, but hopefully at least one of them will find this post and it will save them time!

About Admin

Owner of Savvy Technical Solutions

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.