SP2010 Branding Tip #6 – Mobile Browsers 11

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

11 thoughts on “SP2010 Branding Tip #6 – Mobile Browsers

  1. Reply Jeff Becraft Nov 11, 2009 9:19 pm

    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?

  2. Reply Randy Drisgill Nov 11, 2009 11:33 pm

    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.

  3. Reply Gubo Jul 20, 2010 9:56 am

    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?

  4. Reply Koen Zomers Sep 20, 2010 9:12 am

    This didn’t work for us either. After some research I have found an easier and working way to get the job done. I have briefly described it in this topic:

    http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/d1e58832-391b-42ba-a21b-6ef40d1c9acb

  5. Reply Kamran Oct 13, 2010 3:16 am

    It worked for me for all mobiles and iPhones But It is not working for BlackBerry 9000. Kindly help me out.
    Thanks,
    Kamran
    SharePoint Developer
    Xelleration, LLC

  6. Reply James McCormack Oct 15, 2010 3:58 am

    This approach feels a bit hacky – pretending that the iphone isn’t a mobile browser. Also, if you want to turn off the mobile experience for iPhone, you probably want to turn it off for all mobile devices.

    In that case, how about just deactivating the MobilityRedirect feature from Sharepoint Powershell? I believe the syntax is: Disable-SPFeature -Identity MobilityRedirect -Url http://yoursite

  7. Reply sympmarc.com Nov 17, 2010 1:55 pm

    Great post, as usual, Randy. As we’re thinking about our mobile strategy here at my client, we’re going to go with all until we can sort through what the *right* answers might be, undoubtedly after launch.

    M.

  8. Reply Jeremy Thake Jan 10, 2011 12:38 am

    I’ve added a few other approaches referencing this one here.

  9. Reply Bradley Geldenhuys Jan 10, 2012 3:35 am

    What a fantastic work around, I was almost about to start changing my mobile layout and masterpage thanks for this save!

  10. Reply DJViBE TV Jun 14, 2012 10:39 am

    @GUBU I am having the same issue. Any change to the compat.browser takes the site down.. even once I change the value back to true its still pooched.. good thing I created a backup of the OG file. Could it be becuase I am on SP1 that the fix doesnt work?

  11. Reply Anonymous Jul 5, 2012 11:08 am

    @DjVibe TV… I believe it kills it until you do an IISRESET. Once you do that, things turn to normal.

Leave a Reply