Freigeben über


why doesn't the favicon for my site appear in IE7?

Today I have a mini-FAQ on Favicons.

Q: How do I make a favicon appear for my site in IE7?
A: There are two ways.  The first is to put a file in the root of your domain called favicon.ico.  The second is to use a <link> tag with the rel="shortcut icon" value and the href value set to the URL for the Icon you wish to display.

Q: How often does IE download the favicon?
A: IE will download the icon when a user first visits the site.  The icon is stored in the Temporary Internet Files folder on the client machine.  Additional metadata about the favicon is stored in the user's Url History database. If either store is cleared, or items relating to the favicon have naturally expired, then the icon will be downloaded again on the next visit.  If more than one page (or site) shares the same favicon, it is only downloaded once.  IE takes great pains to download the icon as few times as possible to reduce load on the server.

Q: I see the wrong favicon for some sites I visit.  How do I fix this?
A: If the history database has become corrupted in some way, this can happen.  The simplest solution is just to use Delete Browsing History (on the Tools menu) to clear the cache and the history store. 

Q: I put a favicon.ico on my site as you described, but it still doesn't appear.
A: It must actually be a .ico (an Icon) file.  Bitmaps, pngs, gifs, etc, will not work.  IE7 will download your favicon to the Temporary Internet Files folder and call ExtractIcon() on the file.  If this fails, we will show the default icon instead of your favicon.

Q: I verified that my favicon really is an icon, but it still doesn't appear.
A: Since IE loads your icon out of the Temporary Internet Files folder, it must be able to actually store it there.  If you are setting the no-cache directive for the icon file, then IE will not be able to display your icon and will display the default icon instead.  You can use Fiddler to verify.

Q: How do I create a different favicon for every page on my site?
A: Put a different <link> tag on each page, pointing to a different icon.

Q: I changed my site's favicon to a different icon, but the old one still shows in IE.  How do I force IE to update?
A: If you just put the favicon.ico file in the root of your domain, IE doesn't have any way of knowing if it changed.  To force an update, you need to use a <link> tag and point to a different filename than you previously used.  The current filename is compared against the known filename stored in the Url History database.  When IE sees the filename has changed, it will download your new icon.  Alternatively, you can ask your users to clear their history and cache (Tools->Internet Options->Delete Browsing History), which will also force IE to download the new file.

That should cover most of the questions I've received about favicons in IE7.  If you have more questions, feel free to ask.

Updated on Monday, 5th March to fix a spelling error and add some additional questions.

Comments

  • Anonymous
    March 01, 2007
    PingBack from http://www.ie7security.net/2007/03/01/why-doesnt-the-favicon-for-my-site-appear-in-ie7/

  • Anonymous
    March 06, 2007
    I posted a short FAQ on troubleshooting Favicons in IE7 on my blog . The post has been fairly popular

  • Anonymous
    March 06, 2007
    The simplest way to create an .ICO file used to be to draw the picture in Paint, save it and rename from .BMP to .ICO. Can you please to whether this still works.  And what size - 16x16 or 32x32 is needed and which color depth or bit per pixel are supported. Thanks

  • Anonymous
    March 06, 2007
    Is it possible for IE7 to display animated favicons that other browsers support? If so, how?

  • Anonymous
    March 06, 2007
    The favicons for links I have in the Links toolbar in Internet Explorer 7 work fine, but when I add the links toolbar to the taskbar the favicons don't show up (it just shows the general IE hyperlink icon).   I've cleared the browsing history, deleted and readded the favicons to the links toolbar to no avail. Any ideas?  Thanks so much in advance!

  • Anonymous
    March 06, 2007
    It's worth mentioning here that relative paths in <link /> will not honor the value of a <base /> element.

  • Anonymous
    March 06, 2007
    Windows Explorer, Favorities menu/Start->favorities display wrong or not display any icon (not URL Icon, IE Icon) after update to ie7 How to fix it? (windows XP)

  • Anonymous
    March 06, 2007
    Hubert Daubmeier:   I use Visual Studio to create an icon if I need to.  I've never tried the mspaint thing, but if it used to work I assume it would still work.   The size question is a good question.  MSDN says that favicons must be 16x16, and offically that is the only thing that is supported.  However, we simply extract the icon at 16x16, so if you make a 32x32 icon it should work. Johnathan Kiser: No--IE7 only supports normal, static .ico files.  It is conceivable that this might be something we supported in the future, but there are no definite plans. Kevni Turner: I'll take a look and get back to you. Derek: Thanks for the info.  I believe you are correct.  The reason for that has to do with some implementation details on our side.  I'll file a bug for this. Alex: Try running the Delete Browsing History tool from the Tools menu and revisit those sites.  If that doesn't work, you may be seeing a similar problem to Kevni Turner above.  

  • Anonymous
    March 06, 2007
    Just wondering, does creating a tag like {link rel="shortcut icon" type="image/png" href="/siteicon.png"} work in IE (replacing the braces with gt and lt characters obviously)? I'd expect IE to respect the MIME type, but I'm sure I'm wrong. ;-) If IE is saying "you must MUST provide a website's icon as a Windows Icon File called favicon.ico" that seems a little restrictive and short-sighted, I'd think.

  • Anonymous
    March 06, 2007
    Please do not support animated favorite icons! There are good reasons for the decision to not support the blink tag and they apply equally well to the favorite icon.

  • Anonymous
    March 06, 2007
    Thnx for the explanation. I already saw this some time ago. IE7 only recognizes rel="shortcut icon" .. so with some older sites my favicon disappeared :),l where i still had rel="icon".

  • Anonymous
    March 06, 2007
    "If you just put the favicon.ico file in the root of your domain, IE doesn't have any way of knowing if it changed.  To force an update, you need to use a <link> tag and point to a different filename than you previously used." Or, to put it another way, the guy who originally designed the "put it in the site root" part of the feature really didn't think about it very hard. :-) Then again, the guy who designed the rel="shortcut icon" part didn't think about that very hard either, otherwise he would have noticed that the HTML spec says that rel values are space-separated, and so "shortcut icon" is actually two rel values, not one. Ah, well. I'm sure lessons have been learnt since then :-)

  • Anonymous
    March 07, 2007
    The comment has been removed

  • Anonymous
    March 07, 2007
    Gerv: I agree--the decision to always look in the root was short sited.  It was made in the before-time, so all we could do in the IE7 release was to make it work the best we could.  The same is true for the rel value.  Luckily using "shortcut icon" works for most browsers, since they ignore the shortcut value (which they don't recognize).   Alex: We do respect the mime-type, but all we can currently display is an .ico.  So, if you say it's a png we won't be able to load it.  There are some websites who send their .ico's down as the text mime type instead of icon mime type; we fail to render the icon in those cases too.  Usually this is just a mistake in the setup of their web server software.

  • Anonymous
    March 07, 2007
    Kevni: I was not able to reproduce this on Windows XP.  Are you running IE7 on Vista or XP?   If Vista, the problem is likey due to UAC.  We store the favicon data for internet sites in the low integrity level cache.  Explorer (which includes the Start menu and task bar) run in the Medium integrity level, which means they don't have access to the low cache (that would be a security risk).

  • Anonymous
    March 07, 2007
    I have spent many hours using all the suggestions here in this FAQ and in a variety of other places.  I use the Delete Browsing History tool from the Tools menu but it doesn't make any difference.  For my website and three blogs where Firefox correctly shows the favicons, IE v 7.0 (using Windows XP) hardly ever shows the favicons.  On the rare occasions where one may be displayed it is random and not reproducible. Why Microsoft doesn't forget about the historical way of doing it and just handle it in the obvious way, I can't figure.  This question of saving the bandwidth involved in downloading a 16 x 16 px file is ludicrous.  It would be such a nice feature if it worked reliably.

  • Anonymous
    March 07, 2007
    Barry Welford: Can you send me the URL for your site?  I'll take a look and see if I can't suggest a solution.

  • Anonymous
    March 07, 2007
    <<"put it in the site root" part of the feature really didn't think about it very hard.>> Either that, or they decided that perhaps there's value in enabling this feature in a way that takes a web developer ~15 seconds to update to an entire server, instead of updating a potentially HUGE number of HTML documents.  (Before my time, in any case.) "Shortcut icon" instead of "icon", now that was definitely a simple oversight.

  • Anonymous
    March 07, 2007
    The Wikipedia article on Favicons does a pretty good job of explaining some of the backhistory and recommeded methods for implementation. http://en.wikipedia.org/wiki/Favicon Also, for those who don't have access to a proper icon editor, there are some editors online that will allow you to create your 16x16 image (pixel by pixel in many cases) and download the resulting .ico file. http://favicon.com/ http://www.degraeve.com/favicon/ are a few such sites.

  • Anonymous
    March 07, 2007
    Scratch the comment about online editors and the site favicon.com - it's a pro services site - sorry for the possible confusion there.

  • Anonymous
    March 07, 2007
    Hi Jeff - I am running XP SP2 on my HP work laptop.  I upgraded from IE6 (provided by HP) to IE7.   It's weird, if I open explorer and view the Links folder it shows the IE URL Icon.  The only place it will show the favicons correctly on the links toolbar is in IE7. FYI, it worked fine on my old laptop where I did the same thing.  This is the only PC I've noticed this on.  I have 2 others where it works fine.  Not sure the difference.

  • Anonymous
    March 08, 2007
    Kevin: Well, that is odd.  Have you moved the links folder from it's original location?  What if you add the favorites folder as a toolbar to the task bar?  

  • Anonymous
    March 10, 2007
    why do i the Chinese language now in the top ie bar? no idea where that came from.i was told to repair ie from the add/remove from the c/p. please advise. thanks-tim d

  • Anonymous
    March 12, 2007
    Is IE treating the rel= parameter as an array of values or as a string? Assuming you are currently checking for something like this: relValue == "shortcut icon" Would it be difficult to change that to: @relValues = relValue.componentsSeperatedByWhitespace() @relValues contains "icon" ? Existing sites would continue to work, and so would rel="icon" rel="icon shortcut" rel="shortcut logo icon small-fish" etc. Also, if you intend to only accept Windows Icon files in future, please ensure you are sending the correct Accept HTTP header, just listing that one MIME type and no others (especially not / !). These would be standards-compatibility enhancements with no foreseeable negative effects besides people who were serving IE with one shortcut file and other people with another file possibly getting confused. Also, sites sending incorrect MIME types for .ico files might not serve the file if the href does not include the file extensions and MultiViews is turned on. But then these sites can go fix their problem instead, as it wouldn't work in FireFox anyway.

  • Nicholas ps. I don't have Windows or IE to check the answers to these myself
  • Anonymous
    March 12, 2007
    Nicholas: IE treats it as a single string.  That is, we look for "shortcut icon" specifically.  This was how the feature was originally implemented and did not change in IE7 for compat reasons.  However, other browsers do the right thing, so rel="shortcut icon" should work for browsers that just want rel="icon". The vast majority of sites don't use the <link> tag at all--they just drop favicon.ico in the root.  Becoming more standardized would break many of those sites.  I agree that there are things we could improve though.

  • Anonymous
    March 12, 2007
    The comment has been removed

  • Anonymous
    March 13, 2007
    The comment has been removed

  • Anonymous
    March 14, 2007
    Interesting reminder: Favicon.ico should be as small as possible. http://www.hanselman.com/blog/FavIconicoCanBeABandwidthHog.aspx

  • Anonymous
    March 14, 2007
    Hi Jeff! The question and answers are great- was trying to find out why my favicon didn't display on IE7 and found your blog - i've already been able to fix a few things, but ..mine still doesn't work!? I work on a mac so haven't the foggiest sometimes at solving things on PC- that could also be the problem.. ;) Another thing that might be related is if i type the url the favicon is at (for example 'mysite.com/favicon.ico') i get a list of questionmarks ???yh?? etc [I see this when I check it on a mac using firefox] but on pc IE7 it displays the favicon.ico but not in the url bar!? any suggestions or any reason it would do this- Thanks, Dan On most sites it will display the favicon  

  • Anonymous
    March 16, 2007
    Dan: From what you've said it sounds like it could be a corrupt icon or a format we don't recognize.  If you send me a link to the site where you are seeing this happen, I can tell you for sure what the issue is.

  • Anonymous
    March 16, 2007
    Jeff: You should be able to see it at www.outinthewops.com & icon is at www.outinthewops.com/favicon.ico - hopefully it is not corrupt :( i made a 16x16 file in p-shop and followed as much of the online advice as i could! Thanks for your help! Dan

  • Anonymous
    March 17, 2007
    The comment has been removed

  • Anonymous
    March 18, 2007
    Agencies often resell these loans in huge blocks as mortgage-backed securities, thus  The more common term for junior mortgage loans, which are recorded behind the first mortgage lien

  • Anonymous
    March 20, 2007
    The comment has been removed

  • Anonymous
    March 20, 2007
    Thanks Jeff- Thats great news you can see!! I had tried to delete history but it seemed to be just doing it for the url addresses.

  • Anonymous
    March 20, 2007
    Yep problem solved i can see it too! Found how to delete all the history in tools! Cheers for the help :)

  • Anonymous
    March 27, 2007
    The real question is: why do you still use i.e.?

  • Anonymous
    April 01, 2007
    I downloaded IE7 and everything is fine except when I close the browser it gives me the following Error message on the Iexplore.exe :Application Error, The exception unknown software exception (0x0eedfade) occured in the application at location 0xc812a5b. It is annoying at each time to say OK. I also get a Running Time Error 271 AT0312BFB4A. How can I resolve this annoyance. Thanks Tony

  • Anonymous
    April 02, 2007
    Tony-- Likely you have an extension installed that is causing this crash-on-exit bug.  Try running IE with add-ons disabled: Start -> Programs -> Accessories -> System Tools -> Internet Explorer (No Add-ons) If that solves the problem, you can try to track down exactaly which extension it is by turning them off/on one-by-one in Tools -> Manage Add-ons inside IE, restarting IE after you disable each one. Or you can try upgrading to the latest version of your extensions.  Most have updates that make them compatable with IE7.  I know the Live toolbar needs to be updated to the lastest version.  The same may be true of other toolbars.

  • Anonymous
    April 03, 2007
    Tried deleting only me temporary internet files -> No go. Argh, argh, what's the issue? (Headscratching). Read the comment about deleting ALL your history needing to be deleted, tried it, and yes. favicon.ico in all its glory! Yay! So: IE7-> Delete ALL temp files when testing, instead of just images. Thanks for the tip guys (and girls)! Best regards, Dominique

  • Anonymous
    April 06, 2007
    Thanks Jeff, My IE is currently running without add-on ( I found out after I followed your recommendations) so that was not the fix. I still have the problem. I am going to try to update to the latest versions of my extensions (toolbars) and see what happens. Tony

  • Anonymous
    April 11, 2007
    These favicons- If I remember correctly, there's a way to tell IE7 to check for and download any that your Favorites might have, right? I can't remember how, though. Anyone refresh my memory, or tell me that I'm insane?

  • Anonymous
    April 13, 2007
    this is the coding in my heading <LINK REL="SHORTCUT ICON" HREF="http://www.truckchamp.com/tc.ico"> the tech at Monster Commerce-who supports our site - added it.   Should it be <a href=...

  • Anonymous
    April 16, 2007
    The comment has been removed

  • Anonymous
    April 25, 2007
    Jim-- If you send me a link to your site, I can have a look and help you get it working.

  • Anonymous
    April 25, 2007
    Paul-- If you just visit the favorite in IE7, it should be downloaded and displayed when the page finishes loading.

  • Anonymous
    April 26, 2007
    I've tried over and over again to make the short cut icon work.  I made a 16X16 icon file and i have IE7 and XP it's  for a friends class project and it's supposed to have the same icon as the mouse for the favicon. the one i've been working on to show her how to do it is at <a href="http://www.geocities.com/crayon_colored_girl/others/kittypage.html">Lacey's Kitty Page</a> =/ is it because of geocities? bah i can't figure it out. but i'd like to be able to use it on my pages too. =/ JEssie~<3

  • Anonymous
    April 30, 2007
    I think the problem may be the location of your link tag.  You have a bunch of HTML before the opening <html> tag, which I think is causing IE's parser to do wierd things.  

  • Anonymous
    May 16, 2008
    Sunshine... 80 degrees... must leave the office.... Here's the reading list... Have a good weekend. ITP