1

I've been making a few DOM modifications to the SuiteBar in 2016 using javascript/jquery and I've noticed that sometimes on first load the changes don't take at all or only some do. To fix it, reloading the page solves the problem.

I think our main issue is that we aren't using master pages but Control delegates instead and for some reason I haven't be able to force this script to load at the end of the page instead so I'm facing a timing issue on first load, likely cause the file isn't in the cache by then.

I'm trying to find a more consistent approach. This is what I'm doing:

$(function () {
    // Wait for resources, then do stuff
    SP.SOD.loadMultiple(['init.js', 'sp.core.js', 'sp.runtime.js', 'sp.js'], function () {
        // Prepare page
        var siteTitle = $('a.o365cs-nav-appTitle > span.o365cs-nav-brandingText');
        siteTitle
            .empty()
            .text(title)
            .closest('a').attr({
                'href': myobject.currentPath(),
                'title': myobject.returnHomeTitle
            });

    // Replace site logo and set link to home
    $("img.ms-siteicon-img")
        .attr({
            "src": myobject.siteLogo,
        })
        .closest('a')
        .attr('href', myobject.currentPath());
    });
})
3
  • Have you thought of injecting the code in the pagelayout? Commented Jun 1, 2017 at 20:20
  • @AhmedMahmoud what do you mean, editing the master page?
    – Batman
    Commented Jun 9, 2017 at 14:24
  • I was thinking that you can create a page layout and inject this code inside it, then create your pages off that page layout! Commented Jun 12, 2017 at 19:04

1 Answer 1

-1

With the Release of the SharePoint 2016, Microsoft Introduced new PowerShell cmdlets which will set these things in a couple of lines.

If you are ok with PowerShell, you can follow below approach.

  1. To change Suite Navigation Branding Text

$webapp = Get-SPWebApplication “http://ca.krossfarm.com
$webapp.SuiteNavBrandingText = “Central Admin (Dev)”
$webapp.Update()

  1. To Set the Logo

$webapp.SuiteNavBrandingLogoUrl ="http://ca.krossfarm.com1/Shared%20Documents/leaf-and-flames-logo.jpg"

$webapp.SuiteNavBrandingLogoTitle ="KrossFarm"
$webapp.SuiteNavBrandingLogoNavigationUrl = "http://ca.krossfarm.com"

$webapp.Update()

MSDN Ref link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.