I am not sure this is possible. Is there a way to make the SharePoint that appears in the upper-left hand corner to be linkable? I want users to be able to click on "SharePoint" and take them to a site collection home page. Is this possible? If so how can this be done?
-
1I am not sure if there's a way to do it out of the box, you would need to add a script to all pages (custom action) to switch it to a hyperlink.– Mohamed DerhalliCommented Dec 22, 2016 at 16:28
-
1You should be able to as you can change the text. The div for it should be ms-core-brandingText– Flat BananaCommented Dec 22, 2016 at 16:29
-
@FlatBanana wouldn't ms-core-brandingText just change the text and not allowing to add a hyperlink to the page?– SharePoint LadyCommented Dec 23, 2016 at 0:54
-
.ms-core-brandingText{href:www.google.com}</style> Do you think this could work?– SharePoint LadyCommented Dec 23, 2016 at 2:17
-
unfortunately, this does not work, there is no property called href in CSS , so you should use JS as I have mentioned in my answer that tried on my side and working properly, hope it help :)– Mohamed El-Qassas MVP ♦Commented Dec 23, 2016 at 2:46
4 Answers
I wrote the following code in a script editor that working properly.
<script>
function doredirect() {
//var x = document.getElementById("suiteBarLeft");
var x = document.getElementsByClassName("ms-core-brandingText");
x[0].onclick = doaction;
x[0].style.cursor='pointer';
}
_spBodyOnLoadFunctionNames.push("doredirect");
function doaction()
{
window.location.href="http://Qassas";
}
</script>
To apply it to all pages, you can do
- AdditionalPageHead delegate control, or
- Custom Action , or
- Just edit your master page and paste the above code below
</body>
(tried also from my side)
No need to Javascript.... You could simply edit your masterpage (it's what I did wiht mine). Search for :
<div class="ms-core-brandingText">SharePoint</div>
And change to:
<a href="/" title="Go to Homepage" class="ms-core-brandingText">Name of your website</a>
You don't need JavaScript or Master Page customisation to change the behaviour fo this SharePoint Branding text. It's a property of the web application and can be set web application wide.
$webApp = Get-SPWebApplication http://tozit-sp:2015
$webApp.SuiteBarBrandingElementHtml = "Awesome Text Goes Here"
$webApp.Update()
Source: SP 2013: Tip - Change the "SharePoint" text in the top left corner.
You will finde more detailed information at the source.
In pure javascript, try below code:
<script type="text/javascript">
document.querySelector(".ms-core-brandingText").addEventListener('click',function(){
window.location.href = _spPageContextInfo.webAbsoluteUrl; //change url as per your requirement
},false)
</script>
If you are using jQuery, you can try below code:
<script type="text/javascript">
$("div.ms-core-brandingText").click(
function()
{
window.location.href = _spPageContextInfo.webAbsoluteUrl; //change url as per your requirement
return false;
});
</script>
You can add the code in masterpage just above the </body>
tag if you want it across the site collection. If you want it on specific pages, add in the respective page layouts or add script editor webpart on the page.