favicon not displayed by Firefox

FirefoxFavicon

Firefox Problem Overview


I DO know this question has been asked at least a thousand times in this website alone, but I HAVE read many of those threads, I DO consider myself very knowledgeable and rarely ever ask anything, instead prefer to do my own research.

However, THIS issue is so strange, without hope for real enlightenment (since this question HAS been discussed so often and still I could not benefit from reading there), here is my issue:

favicon.ico exists, and (locally hosted development website) http://website/favicon.ico displays the correct icon. Its size is a mere 198 Bytes, so the size limit I found in Firefox's about:config of 1024 Bytes is adhered to. According to the wisdom on favicons on the web the browser should ask for favicons on its own when there is nothing in the of the page. However, my apache log clearly shows Firefox (9.01) never even asks for it.

Next: when I add

<link rel="shortcut icon" href="/favicon.ico">

I still don't get a favicon.

Next: when I instead use

<link rel="shortcut icon" href="/favicon.ico?">

(note the trailing "?") I suddenly DO get a favicon. BUt it cannot be a cache issue! First, I have cleared the cache, second, as I mentioned above, I already successfully loaded the icon file into Firefox through its URL http://website/favicon.ico

I am unable to explain this behavior of Firefox. Chrome shows the correct favicon, by the way.

This is my page head:

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
    <link rel="shortcut icon" href="/favicon.ico?" />
</head>
...

As soon as I append at least the "?" after "ico" it works.

Here is what the server sends when the icon is requested, since some have asked for this. I have no idea why this would be useful, since a) I said my cache was empty for each test (checked with about:cache too), and b) I said the server is never even asked for the file when it does not show up. Firefox just does not ask without the "?" - with cache empty! The request shows up in the apache log ONLY when I use the appended "?".

Date	Fri, 23 Dec 2011 12:53:22 GMT
Server	Apache/2.2.20 (Ubuntu)
Last-Modified	Fri, 23 Dec 2011 12:02:49 GMT
Etag	"12c07fe-c6-4b4c132190e30"
Accept-Ranges	bytes
Content-Length	198
Content-Type	image/x-icon

Firefox Solutions


Solution 1 - Firefox

First, make sure you don't have a "normal" cache problem by loading the favicon URL directly (put it into the browser's URL bar) and force-refreshing it. If that does the job, no need for the complicated solution below.



IMPORTANT:

My original problem cannot have been a cache issue: First, I did clear the cache, second, as I mentioned above, I already successfully loaded the icon file into Firefox through its URL http://website/favicon.ico

So I do (did) get the right icon in the browser when loaded directly! But I still have (had) the wrong icon displayed as "favicon". Loading the icon file directly is (or was) independent of the display in the actual favicon location (except for when it is loaded for the very first time of course).

However, if you only have a cache issue and force-refresh works for your than this question/issue is NOT yours! And your answer isn't an answer for this issue.

People should not ignore facts. When you are bombarded with lots of already answered and/or useless questions the quality of the question suffers for the moment and for the archive too. It is amazing how I have to fight with people who still insist that a force-refresh is the answer!



Note: You can avoid this issue entirely by using a cache-buster URL just like StackOverflow does, their favicon URL ends in .../img/favicon.ico?v=4f32ecc8f43d.

If normal cache clearing measures fail (just like they did for me) an answer is given here: "Clearing All Favicons From Firefox 3 Cache [How-To]" -- and here is an archive.org version of the link (probably slower, but it won't go away).

The steps from that page reproduced here:

  1. Install the Firefox add-on SQLite Manager
  2. Launch it from Tools -> SQLite Manager
  3. Click the "Database" menu item (top left) and select "Connect Database", enter %APPDATA%\Mozilla\Firefox
  4. Open the Profiles folder and go to the profile you use
  5. Select places.sqlite as the database file to edit (Firefox 61 and later: favicons.sqlite)
  6. Either choose the moz_favicons table. From the right-click context menu use "Empty table", do not use "Drop table" (the table must be there) or use the right-click context menu over the data and select "Delete" over only the one entry that you want to remove (see screenshot below)

screenshot deleting an entry using SQLite manager

I started suspecting that Firefox caches favicons separate from everything else - it was the only explanation matching the observed behavior. So I googled for confirmation and found the above URL. Next I'll try clearing that particular extra cache and see what happens.

UPDATE - SOLVED: After deleting the favicon cache using the "SQLite Manager" Firefox add-on all works as it should.

So the secret was the EXTRA (sqlite) CACHE FOR FAVICONS in Firefox, WHICH IS NOT CLEARED BY THE REGULAR "Clear Cache" command.

Update March 2017: I checked this Firefox add-on and also the standalone app suggested in this answer below and both do the job. The SQLite Manager add-on was last updated ~2 years ago according to its Github project page, but it still does what it's needed for in this context. There are updates available from people who have forked the project, but that is just an aside.

Solution 2 - Firefox

Long time ago, I know, but the cache clear procedure on FF 31.0/Windows works for me - maybe it's new. Options -> network -> cached web content -> clear now. Shut down FF, restart. No messing about with SqLite, new favicon loads.

However, there is another potential problem. The server for the site which I was trying to refresh the icon for had a DocumentRoot of /var/www. This site was at foo.com/fubar, where var/www/fubar symlinked to somewhere else. In other words, the site is one level down from DocumentRoot. This works for Chrome, Opera, and IE, but not Safari or FF:

<link rel="shortcut icon" href="/favicon.ico" >

FF looks for the favicon in /var/www, instead of /var/www/fubar. This works for all 5 browsers:

<link rel="shortcut icon" href="favicon.ico" >

Solution 3 - Firefox

was facing similar issue. Just break the cache of image. I am using MVC Razor View.

    var link = document.createElement('link');
    link.type = 'image/x-icon';
    link.rel = 'shortcut icon';
    link.href = "/images/[email protected]";
    var head = document.head || document.getElementsByTagName('head')[0];
    head.appendChild(link);

Solution 4 - Firefox

Here is how to do it without losing all the favicons

  1. Get an tool that can open SQLite file, i am using DB browser for SQLite

  2. go to about:profiles in your browser.

  3. open the root folder of default profile. (see attached image for hints) image

  4. open places.sqlite (favicons.sqlite on Firefox 61+) file.

  5. go to moz_favicons table

  6. filter and delete the entry for your hostname(see attached image for hints) image

  7. save file (see image) image

  8. visit your website it will show new favicon

Solution 5 - Firefox

I had this problem just now it seems the cache, cookies, and history have no effect but i did this which fixed it.

1 - Right click on the bookmark (mine is in the toolbar menu) 2 - Click on properties 3 - Then click on cancel (seems to refresh some hidden cache)

im sure clicking ok / save will have the same effect.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionM&#246;rreView Question on Stackoverflow
Solution 1 - FirefoxMörreView Answer on Stackoverflow
Solution 2 - FirefoxEMLView Answer on Stackoverflow
Solution 3 - FirefoxgokulView Answer on Stackoverflow
Solution 4 - FirefoxSurajView Answer on Stackoverflow
Solution 5 - Firefoxuser3542609View Answer on Stackoverflow