Saturday, January 16, 2016

Minimal Download Strategy feature in SharePoint 2013

This is a new feature that came up in SharePoint 2013 that is used to optimize page rendering. It reduces the page loading time by sending only the differences that were made to the page when users try to access a new page.

So in detailed words, Minimal download strategy takes care reducing the amount of data that the client browser has to download when users navigate from one page to another page within a SharePoint site. When a user browses a site that has the MDS feature enabled on it, the user will see only the differences (or delta change) between the current page and the requested page.

Methods to activate Minimal Download Strategy:

The Minimal Download Strategy feature (MDS) can be enabled in a SharePoint site using the below mentioned methods.

  1. Activate the MDS feature using the site settings UI.
  2. Using PowerShell Command
  3. Using Server Object Model
  4. Using Client Object Model

Now, let’s take a look at the first two methods….

Using the site settings UI:

Go to site –> Site settings –>Manage site features–> Activate Minimal Download Strategy

1

Using Power Shell command:

Use the below mentioned Power Shell command to activate the MDS feature in a site.

$web=Get-SPWeb “http://ift.tt/1J8VfOA;

$web.EnableMinimalDownload=$true;

$web.Update();

To disable the feature, use the below command:

$web=Get-SPWeb “http://ift.tt/1J8VfOA;

$web.EnableMinimalDownload=$false;

$web.Update();

Enable/Disable MDS through PowerShell:

You can use the “Disable-SPFeature / Enable-SPFeature” commands to enable or disable the MDS feature.

The following command will disable the MDS for a particular site.

Disable-spfeature –url http://SharepointSite –identity “MDSFeature”

Power Shell Command Enable/Disable MDS across all web applications:

foreach($webApp in Get-SPWebApplication)

{

    foreach ($SPsite in $webApp.Sites)

    {

       foreach($SPweb in $SPsite.AllWebs)

        {

             Disable-SPFeature –identity “MDSFeature” -URL $spweb.URL -confirm:$false

        }

    }

  }

Identifying whether MDS is working on your site:

Once you’re done activating the MDS feature in your SharePoint site you can confirm its functionality by taking a look at the site url …

2

You can notice all the pages having “start.aspx” for rendering.

The requested new page url will have a prefix of “#” before it.

URL’s formatted in MDS mode:

Non-MDS URL MDS URL
http://server/SitePages/ http://server/_layouts/15/start.aspx#/SitePages/
http://server/subsite/SitePages/home.aspx http://server/subsite/_layouts/15/start.aspx#/SitePages/home.aspx
http://server/_layouts/15/viewlsts.aspx?BaseType=0 http://server/_layouts/15/start.aspx#/_layouts/viewlsts.aspx?BaseType=0

So how this works:

There are 2 components that enable MDS:

  1. Server-side
  2. Client-side

Each page will be divided into multiple sections.

When a client requests a new page, the server calculates the delta (changes). Only the changed sections will be sent to the client. The client will be smart enough to patch the received sections to appropriate sections.

Let’s take a look at the below mentioned example from TechNet:

3

Figure 1 shows the sections that change from page to page and therefore require an update. The delta usually includes the data in the (1) content areas, as well as other components such as (2) navigation controls.

We can identify a site that has MDS enabled by taking a look at the URL. An MDS-enabled site has the (3) _layouts/15/start.aspx page in the URL followed by a hash mark (#) and the relative URL of the requested resource, as shown in

Figure 1. For example, the following is the MDS-formatted URL for the page newpage.aspx:

https://sp_site/_layouts/15/start.aspx#/SitePages/newpage.aspx

This is equivalent to the below mentioned non–MDS-formatted URL:

https://sp_site/SitePages/newpage.aspx

MDS Flow Mechanism:

4

  1. The browser requests the changes between the current page and a new one in the SharePoint site.
  2. The MDS engine in the server calculates the delta between the current and the new pages.
  3. The MDS engine in the server sends the delta to the MDS engine in the client.
  4. The MDS engine in the client replaces the changed areas on the current page with the new page content.

Benefits of Minimal Download Strategy :

  • Speed:This is the main objective of using MDS in your SharePoint site. When you are using MDS, the browser doesn’t have to reprocess the chrome user interface (UI). MDS also reduces the payload compared to a full page load.
  • Smooth transitions:By updating only the areas that change, you draw the user’s eye toward these areas, as opposed to a full page load where the whole page “flashes.” When the whole page is updated, the user must parse it in its entirety to detect what is new. Users have an easier time navigating a site that only updates the areas that changed from the previous page.
  • Browser navigation controls:Other AJAX-based systems confuse the previous and next buttons in browsers. Because MDS updates the URL in the browser window, the previous and next buttons work just as they are supposed to.
  • Backward compatibility:The MDS engine either provides MDS navigation immediately or detects when it isn’t possible. In the case where MDS navigation isn’t possible, a full page load occurs instead. This process is called failover, and it ensures that all pages render properly regardless of whether they contain MDS-compliant components. MDS also works nicely with search engines because the href attribute of anchor tags uses the regular, non MDS-formatted URLs. Instead, the MDS engine in the client captures the onclick event and uses it to communicate with the server.

Note: The Minimal Download Strategy is enabled by default and can be disabled if necessary .You can disable it on a per Web application basis /Site basis using the UI or PowerShell command.

So in a nutshell, the MDS (Minimal Download Strategy) is a new feature that came up in SharePoint 2013 that helps in page optimization by only loading the changes made to a page when an end user tries to access a new page in a SharePoint site.

Happy SharePointing !!!  Thanks for reading this post.

 


by Vignesh Ganesan via Everyone's Blog Posts - SharePoint Community

No comments:

Post a Comment