Show Ribbon in SharePoint 2016 by default

Sometimes we need that the ribbon in SharePoint is shown by default. On some pages like One Drive for Business is hidden and for example we have some specific stuff on its area for which we want to be visible when user come to that page.

We can manually show it with a Show Ribbon button in the Settings Menu.

2017-07-14_1044

But we want to show it automatically by default. One of the possible solutions is shown below in JavaScript code:

(function ($) {
    function PreveriQueryStringParameter(parameter) {
        if ((window.location.toString().indexOf("?" + parameter) !== -1) || (window.location.toString().indexOf("&" + parameter) !== -1)) {
            return true;
        } else {
            return false;
        }
    }

    $(document).ready(function () {
        if (($("div#DeltaSPRibbon").children().length == 0) && (!PreveriQueryStringParameter('ShowRibbon'))) {
            STSNavigate(StURLSetVar2(ajaxNavigate.get_href(), 'ShowRibbon', 'true'));
        }
    });
})(jQuery);

Cheers!
Gašper Rupnik

{End.}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: