FIX: Scroll bar missing in Chrome

Scenario:
SharePoint pages missing scrollbars in Google Chrome.

Fix:
In your master page, replace this line:

 <body scroll="no" onload="if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" class="v4master">  

with:
 <body scroll="no" class="v4master">   
   <script type="text/javascript">  
     //using this jquery script to fix issue with scrollbar missing in Chrome; note the dependency on jquery; replaced the below line  
     //<body scroll="no" onload="if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();" class="v4master">  
     $(document).ready(function () {  
       if (typeof (_spBodyOnLoadWrapper) != 'undefined') { _spBodyOnLoadWrapper(); }  
     });  
   </script>   

Note that, because this solution is using jquery, you also need to add a reference the jquery library in the <head> section of the master page:

 <head runat="server">  
 ...  
 <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>  
 ...  
 </head>  

Cause:
There seams to be a timing issue in Chrome, as _spBodyOnLoadWrapper is not available by the time the onload event is fired but it is available when ready is fired.

Leave a Reply