As you probably all know, SharePoint 2010 allows site administrators to change the sites logos just like 2007 did. This is done on the “Title, description, and icon” page
The picture then appears in the top left of the site pages, just before the page title/breadcrumb
The trouble is that this doesn’t work on WebPart pages, no matter what you do; users will still see the default yellow icon.
Cause
WebPart pages use the TitleBarWebPart, this WebPart allows you to specify a title and logo for the page using the button in the ribbon bar
The problem here is that whatever you do, this Web Part always overrides your site logo setting. If you specify a page specific logo along with the title, it will use it. If you don’t specify a page specific logo, it will use the default SharePoint logo.
This overriding is done in javascript by the code below that you will find at the end of your web part page :
var logoImg = documentGetElementsByName('onetidHeadbnnr0'); if (logoImg != undefined && logoImg[0] != undefined) logoImg[0].src='/_layouts/images/siteIcon.png';
This javascript code is generated by the TitleBarWebPart, the “/_layouts/images/siteIcon.png” is replaced with the page specific logo if you set one. Thus this WebPart systematically overrides the site wide logo settings.
By the way you will notice that it doesn’t work under Chrome 8 because of a Javascript error.
Solution
Aaron Han suggested removing the Web part from the pages impacted on a MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010customization/thread/9706669e-0488-45cd-9cf6-2edfef91f77f
If you don’t want to edit every single WebPart page and/or if you want to retain the ability to change the page title I have another solution for you.
My solution is to change the SiteLogoImage node name in the master page. Thus the javascript generated by the PageTitleWebPart is no longer able to change the logo.
Details
Open your master page and find the line starting with:<SharePoint:SiteLogoImage name="onetidHeadbnnr0"And replace the “onetidHeadbnnr0” name with something else; “onetidHeadbnnr1” will do the trick.
10 comments:
Thank you A LOT!! This helped me very much :) Haven't experienced any downsides on the last solution, so it's good.
Regards,
Christopher R
Thanks a lot.
I have to change the name in the defaul.master and v4.master, and works.
Regards.
Hi
Just applied this to our custom v4.master. Why on earth is the javascript looking for the element: "onetidHeadbnnr0" which doesn't exist in the web part pages... is this a bug or intended.
Hello and thank you for your post. The side effect that I found was once you apply the fix, then users can no longer override the logo. If they set the logo in Title Bar Properties, it is simply ignored.
Lifesaver :) Been pulling my hair out trying to figure this. Didn't pose a problem in Chrome, the custom logo was there throughout... But IE and Forefox.. ARGH! Your solution worked a treat, no adverse side affects observed... THANKS!
Thanks for this post. The changing of SiteLogoImage attribute name really did the trick.
Thanks
That works !!
There is no need to change the masterpage, instead specify the custom image path again in the webpart page's ribbon --> set tile bar properties.
Now the default site image works on all browsers.
@ashish
That's fine if you only have 1 page but we have dozens of web part pages and don't want to have to change them all again.
This is stupid behavior in the first place. There is no reason for sharepoint to change a logo using javascript. Can someone explain why this code exists?
Post a Comment