SP2010 Branding Tip #6 – Mobile Browsers

One interesting feature of SharePoint 2010 is that it automatically shows a nice mobile experience when mobile devices browse the site. There is no need to type in the mobile URL (by appending /m to the URL) as you had to in SharePoint 2007. Here is a screenshot of what the SharePoint site looks like on my iPhone, I simply navigated to the usual site URL:

image

While this is terrific for intranet sites, its less than ideal for public internet sites, especially ones that have a lot of custom branding. In those cases, typically you would want smart phones like the iPhone to see a standard rendering of your site. So, how do we turn off the automagic mobile experience? There doesn’t appear to be a setting for this in the Site Settings or in Central Administration. I had to ask around on this one, and the SharePoint product team was kind enough to point me in the right direction. Turns out you need to edit the “compat.browser” file for your SharePoint site. To find this file, look in your IIS directory for your SharePoint site and look for the App_Browsers folder. Mine file was located at:

C:\inetpub\wwwroot\wss\VirtualDirectories\portal.contoso.com80\App_Browsers\compat.browse

This file has settings for MANY popular browsers, including most mobile browsers. In my example I want to change the mobile setting for the iPhone browser so I found this section:

<!-- iPhone Safari Browser -->
    <!-- sample UA "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; ja-jp) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A345 Safari/525.20" -->
    <browser id="iPhoneSafari" parentID="AppleSafari">
        <identification>
            <userAgent match="iPhone" />
            <userAgent match="Mobile" />
        </identification>
        <capabilities>
            <capability name="isMobileDevice"                    value="true" />
            <capability name="canInitiateVoiceCall"              value="true" />
            <capability name="optimumPageWeight"                 value="1500" />
            <capability name="requiresViewportMetaTag"           value="true" />
            <capability name="supportsTouchScreen"               value="true" />
            <capability name="telephoneNumberDetectionDisabled"  value="true" />
        </capabilities>
    </browser>

To turn OFF the automatic mobile version of the site for this phone, we just need to change isMobileDevice from True to False and save the file. With the isMobileDevice set to false, now when I browse my SharePoint site I see the standard branding:

image

3 comments:

Jeff Becraft said...

Nice! I haven't tried this trick yet. Do you get full SharePoint functionality on the iPhone when you turn off the automagic mobile experience?

Randy Drisgill said...

I actually hadn't checked on the content author / admin experience from the iPhone. Just checked. Let's just say in the build I have, the experience wasn't so hot with the ribbon / javascript scrolling. Might work better with a floating ribbon rather than one stuck to the top.

OOTB it looks like the experience is only good for end user site viewers.

Gubo said...

I really need that this trick works for me, but when I change the compat.browser file I get an error for the entire site, even If I only add a backspace to this file. I really need to deactivate mobile browsing, Have you other workaround for this?