Sunday, June 22, 2014

How to Disable Mobile Views in SharePoint 2013

SharePoint 2013's new mobile features are definitely improved a lot from its previous versions. Now it provides support for a variety of mobile devices, Geo-location, Office Web Apps integration, Device Channels, etc.  However there are certain shortfalls in SharePoint 2013 mobile view such as it doesn't provide responsive web sites, lack of menus and navigation, features like people picker, upload files doesn't work, calendar views are too difficult navigate, etc.

SharePoint 2013 mobile example

sharepoint 2013 mobile home page
sharepoint 2013 mobile interface
sharepoint 2013 list mobile view
SharePoint 2013 disable mobile redirect
In my case, we wanted to take control over mobile web sites and disable mobile view for our public SharePoint web sites, as it loads default mobile view with most of the features disabled. Here are the two methods that helped me to turn off mobile view in SharePoint 2013.
  1. Deactivate Mobile Browser View feature
  2. Disable Mobile redirect behavior in SharePoint 2013

Method 1: Deactivate SharePoint Mobile feature

In SharePoint 2013, the Mobile Browser View feature is enabled by default for all sites. This feature is responsible for rendering different User Interface when SharePoint is viewed on a mobile devices To Deactivate Mobile view in SharePoint 2013 follow these steps:
  • Open your SharePoint site >> Click on Site Settings
  • Click on "Manage Site Features" link under site actions section.
  • Locate and click on "Deactivate" button next to "Mobile Browser View" feature
    sharepoint 2013 disable mobile site
That's all! This disables mobile redirect on the particular SharePoint site. But wait! This feature is scoped at site level. So, if you want to turn off mobile view for your SharePoint 2013, you have to repeat these steps in each and every site in your web application!

Disable mobile view in SharePoint 2013 using PowerShell
Fortunately, we have PowerShell. Lets use PowerShell to deactivate mobile friendly sites.
Disable-SPFeature -Identity MBrowserRedirect -Url http://yoursite 
Mobile view is scoped at web object. So in order to disable mobile view on all sites in the web application, Here is my PowerShell script.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$WebAppURL = "http://portal.crescent.com"

#In SharePoint 2010: $FeatureName = "MobilityRedirect"

$FeatureName = "MBrowserRedirect"

#Disable Mobile View feature on all sites in the web application
$WebsCollection = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL 

#Itereate through each web
ForEach($Web in $WebsCollection)
{ 
    #Check if feature is already activated
    $feature = Get-SPFeature -web $Web.Url  | Where-object {$_.DisplayName -eq $FeatureName}

    if($feature -ne $null)
    {
        #Disable the Mobile browser view feature 
        Disable-SPFeature -identity $FeatureName -URL $Web.URL -Force -Confirm:$false 
        write-host "Feature deactivated at site: $($Web.Url)"
    }
 }

Method 2: Change the redirect behavior of a mobile browser

To disable mobile site, Lets edit the "compat.browser" file - which lists all of the browser "user agent" strings that it will redirect. By default this file is located at "c:\inetpub\wwwroot\wss\VirtualDirectories\80\App_Browsers\compat.browser"
  • Login to your SharePoint Web front End(s), Open IIS Manager
  • From IIS Manager, Right click your SharePoint Web site, and choose "Explore". This will open the virtual directory of your SharePoint web application.
  • Open "App_Browsers" folder and then Open "compat.browser" file in a Notepad (or any other text editor)
  • You'll find multiple "Browser" nodes in file. E.g.
        <!-- Windows Phone -->
        <browser id="WindowsPhone" parentID="IE6to9">
            <identification>
                <userAgent match="Windows Phone"/>
                <userAgent nonMatch="IEMobile"/>
            </identification>
            <capabilities>
                <capability name="isMobileDevice" value="true" />
            </capabilities>
        </browser>
  • Just change the "Value" attribute of the node "Capability" from "true" to "false".
       <capability name="isMobileDevice" value="false" />
  • Search and replace this attribute for all occurrences in the file. Save and Restart IIS! 
This method Turns-Off Mobile redirect for all specific mobile browsers.

Turn Off Mobile Redirect for a Web Application:
While the above method disables mobile redirect per device, There are chances that some devices/browsers may not be listed there. Also there is a high probability of SharePoint service packs overwriting our changtes with latest updates. So, lets see the alternate approach of disabling mobile view in SharePoint 2013 by editing web.config file.

Add the below code with in <configuration> node, just before </system.web> node of the web.config file (located at the root of your SharePoint web site in IIS) of your SharePoint web application.
    <browserCaps>
        <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <filter>isMobileDevice=false</filter>
    </browserCaps>
and my screenshot:
sharepoint 2013 turn off mobile view
This eliminates the ability to detect all mobile browsers in SharePoint 2013. All of these procedures applicable to SharePoint Foundation as well.

Best practice: Instead of disabling mobile views, you can utilize "Device Channels" feature in SharePoint 2013. Device Channels feature lets you to display the same site content with different master pages, page layouts and CSS targeted to specific mobile devices.



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...