tags:

views:

499

answers:

3

Is there a built in way to change the favicon for different themes? If not would it be as simple as creatign a custom control to emit the link tag with the correct url to the icon?

Update

So based on what I have found in order to do this, it looks like I am going to have to create an http handler that will intercept all calls for favicon.ico.

This handler will then determine which theme we are using (in my case it will be based on the domain name), it will then output the themed favicon.ico from the various themes folders.

Since I am supporting IE7, I'm thinking this is the only option I have. Still curious if anyone else has a better way.

+3  A: 

As long as your user is not using IE, that should be fine. IE (up to at least version 7) only reads the favicon.ico file and completely ignores the link tag.

Robert C. Barth
your kidding! I only support IE6 and up :-(
JoshBerke
No, I'm not, unfortunately.
Robert C. Barth
I noticed:-( I was playing around and IE also does some weird caching on the favicons...clearing my cache didn't seem to get rid of the fav icon very annoying. Guess I'll add on my to do list an http handler to do this...
JoshBerke
A: 

Note that per W3Schools

http://www.w3schools.com/browsers/browsers%5Fstats.asp

You should expect about 1/2 your users to be using IE.

Actually 100% of my users are using IE;-) since we are a paid site, although this will change at some point. Also those stats are skewed if I remember. Most people who viisit that site are technical.
JoshBerke
A: 

After some research and thought It looks like the only way to do this and still support IE7 and earlier (I am not sure if IE8 updated support for favicon or not). Would be to dynamically serve the icon to do this you can do the following:

  1. Create and register an HttpHandler to process requests for FavIcon.ico
  2. Configure IIS to send requests for .ico files to ASP.Net (If your using IIS6 or earlier)
  3. Run the logic that you use to determine which theme and from that find the .ico your going to serve up, and send it to the browser.
JoshBerke