Fix SharePoint 2010 for Opera Part I

March 28 2011 One comment

I can’t use IE9 because UAG doesn’t support it yet on VPN connections. I can’t use IE8 or older because they don’t play well with the rest of the Web. I can use Google Chrome, Apple Safari, Mozilla Firefox and of course Opera. SharePoint 2010 plays fine with all these new generation browsers, except for the one: Opera. Opera isn’t supported, and I’m glad to disagree.

Scrollbars are handy but sometimes we don't need them


First things first. The top portion of the Ribbon has a nasty scrollbar slobbering all over it. We’ll get rid of that with a simple CSS rule:

#s4-ribbonrow { overflow: hidden; }

Now onto the hard part. Click the Site Action button on the top left corner of the viewport. Nothing happens? I’m going the skip right through the details. The OnClick event of the Site Actions button calls the MMU_Open() -function which itself calls the MenuHtc_show() -function in order to display the pop-up menu. Both of these functions are located in the Core.js.

A look on the MenuHtc_show() -function tells us the the execution of the function stops, if the browser object doesn’t hold a fresh enough version.

if (!(browseris.ie55up || browseris.nav6up || browseris.safari125up))
    return false;

Apparently the latest Opera build isn’t good enough for SharePoint (in my opionion it’s the other way around). The browseris-object is built in the init.js and there we can see no references to the Presto layout engine Opera uses. I will add a simple and dirty support for opera and I’m not going to modify these two files since that is not in line with best practices. Obviously this is something Microsoft usually fixes in the future with cumulative updates, and they might change something that we are not aware of, making the page scream with Opera again.

I’ve got my external JS file somewhere in the hive, and I’ll just add ‘support’ for Opera. The trick is to camouflage Opera as a Mozilla browser. To do this, I’ll use my favourite JS lib jQuery for dead simple browser detection and pass true the nav6up property of the browseris object if the browser is Opera with a recent major version.

browseris.nav6up = ($.browser.opera && $.browser.version >= 10) ? true : browseris.nav6up;

There you go. The Site Actions menu works and the Fat Lady can sing. Unfortunately there is more. Once you hover over the menu items, the ribbon content goes up. The webpart properties menu is also dead. But this should be enough to get you started with Opera. On the next part, I’ll concentrate on those issues.

Popularity: 3% [?]

One comment to “Fix SharePoint 2010 for Opera Part I”

  1. Aviw says:

    You may just set “Browser Identification” to “Mask as Firefox” in “Site Preferences” menu.
    http://shahrsakhtafzar.com/img/out.php/i2004_opera2.gif

Leave a Reply