Sunday, June 26, 2011

Mobile Views in SharePoint 2010

About Mobile Views:
Mobile views is the out-of-the-box feature of SharePoint 2010 which helps render pages on various mobile devices. Basically mobile view is a standard SharePoint list view.
Hence, in mobile view all the pages, appear as sequence of links.
The supported mobile devices are defined in compat.browser file.

How does it work?

When a SharePoint site is accessed from a mobile device, the mobile device browser submits the HTTP GET request to the SharePoint server. In this request a User Agent parameter is set which denotes the browser of the client machine. SharePoint parses this User Agent string and determines if the client is a mobile device. If it is mobile device then it redirects the requests automatically to mobile view.
SharePoint uses compat.browser file as a metadata for supported browsers.

Problem:
Although, the default mobile view works well for intranet sites, it lacks the UI customizations for Internet facing sites.
Mobile view often consist of sequence of links listed one below another without any custom styles.

Solution:
There are ways to customize SharePoint mobile view. But a quick fix for this is to set isMobileDevice flag to false. This basically disables the default mobile view redirection and simply renders default view.

To implement this, go to
C:\inetpub\wwwroot\wss\VirtualDirectories\80\App_Browsers\compat.browser

Locate the mobile browser you wish to disable.
e.g. If you want to disable mobile view for iPad,
then locate the element <browser id="iPadSafari" parentID="AppleSafari">

And set isMobileDevice to false in capability element under browser element as follows:
<capability name="isMobileDevice" value="false" />

Thats it. This will stop requests from iPad being redirected to default mobile view.
There are however better ways to fix this problem. I will blog on it later.