I want to change the favicon for a SharePoint 2013 site without editing the master page. All examples I find either modifies an existing master page, or creates a new one.

Is there no other way of doing this, be so with javascript, PowerShell or something else?


Actually the AdditionalPageHead delegate control is the way to go. To keep things simple I've wrapped the below code into the ASCX, but it would be better suited in an assembly deployed to the GAC.

<%@ Control Language="C#" compilationMode="Always" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>

    Response.Write("\n<link rel=\"shortcut icon\" href='/_catalogs/masterpage/favicon.ico' />");
    Response.Write("\n<link rel=\"icon\" type=\"image/png\" href='/_catalogs/masterpage/favicon.png' />");
    Response.Write("\n<link rel=\"apple-touch-icon\" href='/_catalogs/masterpage/icon-ipad.png' />");

<script runat="server">
    protected override void OnLoad(EventArgs e)

        foreach (Control htmlHeadChildControl in Page.Header.Controls)
            if (typeof(Microsoft.SharePoint.WebControls.SPShortcutIcon) == htmlHeadChildControl.GetType())
                htmlHeadChildControl.Visible = false;

The code is adding custom favicons for different browsers and hides the SharePoint default favicon. Works for me with SharePoint 2010 and 2013 for years.

For future reference for those who haven't worked with AdditionalPageHead delegate controls, wrap it into the usual feature.xml and elements.xml as described here:

How can I enable JavaScript on every page at a site level?

and here:

Adding multiple controls to AdditionalPageHead

and here:

Best way to add a control to a page without using the MasterPage or a web part?

| improve this answer | |
  • Sweet! I guess the part were you set the visibility of the existing one to false, is the real key to solving this :) – Robert Lindgren Aug 2 '14 at 12:37
  • 1
    Correct.I just wanted to provide a complete example for future reference. – Sig Weber Aug 2 '14 at 13:26

you can change the default FAVICON.ICO in the layouts folder, but that will be for the whole farm

c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\IMAGES

Another option is to script it

(function() {
    var link = document.createElement('link');
    link.type = 'image/x-icon';
    link.rel = 'shortcut icon';
    link.href = 'http://www.stackoverflow.com/favicon.ico';


| improve this answer | |
  • I see the downside also of this being an edit to OOTB files, any CU or SP would risk to override my changes to the file. – Robert Lindgren Aug 1 '14 at 8:39
  • Ah, nice! Javascript :) But it does not work in IE sadly – Robert Lindgren Aug 1 '14 at 8:49
  • there are a couple nice approaches there. you will still have to figure out how to embed it on all pages without changing the master page – Tiago Duarte Aug 1 '14 at 8:50
  • That could be done with a custom action, but as it is not working in IE, I can not use it – Robert Lindgren Aug 1 '14 at 8:51
  • @RobertLindgren Without changing the master page, the JS answer is likely the best you're going to do -- IE10 and below (as well as some Safari and Opera revs) just don't support dynamically altering the favicon: blogs.msdn.com/b/ieinternals/archive/2013/09/08/… so you would have to alter the ASP from SP to make it happen for IE clients – John-M Aug 1 '14 at 14:36

This should be possible using AdditionalPageHead delegate control, That way we can avoid editing master Page.

| improve this answer | |
  • How could it be done so that it overrides the existing one though? The existing one seems to be added by a user control – Robert Lindgren Aug 1 '14 at 10:20
  • You can add multiple controls in Additional page Head ,Sequence controls the order MSDN msdn.microsoft.com/en-us/library/… – Thomson Aug 1 '14 at 10:26
  • I know that, but adding a second control won't help, you would need to override (get rid of) the master page control adding the icon in the first place – Robert Lindgren Aug 1 '14 at 10:27
  • 1
    So you say that AdditionalPageHead is out of scope? :) That leaves your answer not so helpful hehe – Robert Lindgren Aug 1 '14 at 10:37
  • 1
    Sigs solution above actually is a delegate control so you where definitely one the right track (the key was hiding the existing one) :) – Robert Lindgren Aug 2 '14 at 12:39

Use JQuery:

 $('#favicon').prop('href', '/HerePathToYourFavicon/favicon.ico');
| improve this answer | |
  • Changing it with javascript will not be accepted by all browsers (do not remember which by heart) – Robert Lindgren Nov 29 '16 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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