Can we Remove DNN's Favicon LINK tag from the head?

Sep 25, 2013 at 8:09 PM
Edited Sep 25, 2013 at 8:10 PM
Subject says it all, I want to be able to Remove DNN's Favicon LINK tag from the head?
And then add my own LINK tags using PNGs

Is that possible with this Skin Object ?

See this link for reference:
jonathantneal.com/blog/understand-the-faviconlog/understand-the-favicon
Coordinator
Sep 25, 2013 at 11:25 PM
Edited Sep 26, 2013 at 7:59 AM
Hi,

The skin object did not allow you to remove the favicon.
This has to do with how it's injected by DNN.
But I managed to add something to remove it now.

Please download the latest 02.06.06 Release and try this:
<fortyfingers:STYLEHELPER ID="SH1" RemoveFromHead="rel=SHORTCUT ICON" AddToHead="... your new favicons here ..." runat="server" />

Let me know it it works for you.

Timo
Sep 30, 2013 at 5:22 PM
First off, THANK YOU so much for the quick response.
I just got a chance to test this new update, no luck so far removing the link, but I'm still testing.
Were you able to remove it during your testing ?
Coordinator
Sep 30, 2013 at 5:35 PM
Yes I was able to remove it. If you don't let me know, I'll see if I can help you.
Sep 30, 2013 at 6:01 PM
Edited Sep 30, 2013 at 6:27 PM
Timo_Design wrote:
Yes I was able to remove it. If you don't let me know, I'll see if I can help you.
That's strange.

Here is what I found.
In the ProcessRemoveFromHead Method in StyleHelper.ascx.vb it is only looking for HtmlLink and HtmlMeta.
However, in my testing, the DNN favicon is added to a placeholder object in Default.aspx as a System.Web.UI.WebControls.Literal.

So, I added a new Case:
Case "System.Web.UI.WebControls.Literal"
  Dim oLiteral As System.Web.UI.WebControls.Literal
  oLiteral = oControl

  If oLiteral.Text.Contains(oValPair.Parameter) AndAlso oLiteral.Text.Contains(oValPair.Value1) Then
    oControl.Visible = False
  End If
After adding that code, it removes the link tag as expected.
Note, this is a DNN 7.1 test, but I'll also be testing DNN 7.0 in just a little while.

Update: had to make the same changes on a DNN 7.0 installation.
Coordinator
Oct 1, 2013 at 11:47 AM
Hmm, I see now. It changed from a link to a literal in DNN 6
I only tested this in DNN 5 to be honest as the skin object is still compatible with DNN 5 (and did not expect this to have changed).
Thanks for the code and the feedback.

I did change it a bit to make sure only attribute pairs are removed:
                    Case "System.Web.UI.WebControls.Literal"
                        Dim oLiteral As System.Web.UI.WebControls.Literal
                        oLiteral = oControl
                        Dim sFind As String = oValPair.Parameter & "\s?=\s?[""']" & oValPair.Value1 & "[""']"
                        If Regex.IsMatch(oLiteral.Text, sFind, RegexOptions.IgnoreCase) Then
                            oControl.Visible = False
                        End If
I uploaded a new 02.06.06 package with this change in it (and I tested in DNN 6 this time ;-)
Oct 1, 2013 at 1:37 PM
Thanks Timo, great plugin that keeps getting better.

I can now do exactly what I wanted to do, remove the .ICO favicon and replace it with a high quality .PNG and at the same time add apple touch icons, Windows 8 title icons etc.
Coordinator
Oct 1, 2013 at 1:51 PM
I though about creating a skin object especially for that to make it easier.
All with one large png, where the skin object generates the rest (different sizes).

Can you post what you inject when you're done?

Thanks, Timo