Fix for Chrome browser errors in SharePoint

I found this amazing piece of advice a few days ago to completely fix all issues Chrome has running SharePoint. Here is the link to Royal Tutorials, all credit goes to them for this fix.

The common issues I have seen using Chrome with SharePoint have been with the scrolling and the ribbon row. This is caused in part to how SharePoint renders scrolling/ribbon row and in part how Chrome loads scripts.

SharePoint has invested heavily in their Ribbon UI across most of their products, and SharePoint is no different. They want this easily accessible no matter where on the page you are. To handle that they are overriding the browser native scroll function and using JavaScript to position the page and page elements. Additionally they have JavaScript load events to enable buttons and functions on the ribbon row.

In SharePoint most controls loaded on the ribbon are disabled, and once it passes SharePoint security then the scripts are loaded for that control. If the browser attempts to load the scripts before the control is enabled the control will never be loaded. Internet Explorer loads all scripts in order before executing them, so IE works very will with SharePoint. Chrome on the other hand loads script files as it receives them which results in controls never becoming active.

The solution Royal Tutorials suggests is to add a little logic to the master page.

<script type=”text/javascript”>
window[addEventListener ? ‘addEventListener’ : ‘attachEvent’](addEventListener ? ‘load’ : ‘onload’, function(){

The window adds an event listener for an “attachEvent”. It checks if the _spBodyOnLoadWrapper has been loaded yet or not, and if it hasn’t then it calls the load function before the “attachEvent” executes.

That’s it! Six lines of JavaScript to your master page and you have cross browser functionality in SharePoint 2010.

(Views: 387)

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.