Tuesday, January 9, 2018

SharePoint Online - Replace the top bar text using Javascript

This master page hack will help you replace the Office 365 text in the top Bar next to the app launcher


Put this code right above the </body> tag in your master page:




<!---Style the SharePoint top bar logo -->
<SharePoint:ScriptBlock runat="server">
if (typeof jQuery == 'undefined')
{
document.write('<script type="text/javascript" src="//code.jquery.com/jquery.min.js"><' +         '/script>');
}
 var interval = setInterval(function(){
if($('span.o365cs-nav-brandingText').length)
{     
$('span.o365cs-nav-brandingText').html("<a href='https://yourtenant.sharepoint.com/'>My Custom Text</a>");
$('span.o365cs-nav-brandingText').attr("style","padding-top: 3px");
clearInterval(interval);             
}
}, 1000); 
</SharePoint:ScriptBlock>
<!--- End Style the SharePoint top bar logo -->


Source: https://sharepoint.stackexchange.com/questions/108695/replacing-the-office-365-logo-and-link-in-sharepoint-online-suite-bar

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.