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 websites, lack of menus and navigation, features like people picker, upload files doesn’t work, calendar views are too difficult to navigate, etc.
SharePoint 2013 mobile example:
SharePoint 2013 disable mobile redirect
In my case, we wanted to take control over mobile websites and disable the mobile view for our public SharePoint websites, as it loads the 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.
- Deactivate Mobile Browser View feature
- 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 Interfaces when SharePoint is viewed on mobile devices. To Deactivate Mobile view in SharePoint 2013, follow these steps:
- Open your SharePoint site >> Click on Site Settings
- Click on the “Manage Site Features” link under the site actions section.
- Locate and click on the “Deactivate” button next to the “Mobile Browser View” feature
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 the mobile view for your SharePoint 2013, you have to repeat these steps on each and every site in your web application!
Disable mobile view in SharePoint 2013 using PowerShell
Fortunately, we have PowerShell. Let’s use PowerShell to deactivate mobile-friendly sites.
Disable-SPFeature -Identity MBrowserRedirect -Url https://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 = "https://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 the mobile site, let’s edit the “compat.browser” file – which lists all the browser “user-agent” strings to 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 the 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”. 1
<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 changes with the latest updates. So, let’s see the alternate approach of disabling mobile view in SharePoint 2013 by editing web.config file.
Add the below code within <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:
This eliminates the ability to detect all mobile browsers in SharePoint 2013. All of these procedures are applicable to the SharePoint Foundation as well.
Best practice: Instead of disabling mobile views, you can utilize the “Device Channels” feature in SharePoint 2013. Device Channels feature lets you display the same site content with different master pages, page layouts, and CSS targeted to specific mobile devices.