favicon not displayed by Firefox
Asked Answered
B

5

73

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
Blackford answered 23/12, 2011 at 12:22 Comment(2)
Comments are not for extended discussion; this conversation has been moved to chat.Theresatherese
This is the fifth time a moderator has to roll back the post to remove the same rant you've repeatedly told not to put back in. I've now locked it from all edits.Dormeuse
B
143

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.

Blackford answered 23/12, 2011 at 13:23 Comment(10)
That tool does not do more than what's already built into Firefox: "Temporary files, history, cookies, download history, form history".Moron
I know it's a bit old, but I have found that in Chrome, you can simply point the browser to the favicon itself, so you go to http://www.yourwebsite.com/favicon.ico and afterward your favicon cache should have refreshedSikhism
Does this clear the favicon for your site (meaning everyone who visits your site) or just your personally?Russian
@PhilippeGilbert while that might work in Chrome, it does not in Firefox.Tradition
@MörreNoseshine Other than the linked post suggested, I successfully cleared the favicons using SQLiteman (so I didn't need to install some addon just for that). After the following restart of FF (but not before that), the new favicons appeared – so it seems FF additionally caches them in memory somewhere.Tradition
Here is what that link suggests: open the places.sqlite file in your Firefox profile folder, and EMPTY the table moz_favicons (Note: make sure to use "EMPTY' and not "DROP")Warenne
Philippe Gilbert's solution works for me in Firefox 47.Baht
Thank you for this answer, I thought I was going insane! I had no idea that firefox handled favicon cache differently than everything else.Lemmy
With Firefox 61 you need to open and edit the "favicons.sqlite" database file (instead of the "places.sqlite" db file).Katha
isnt this a local browser issue? how does this solve on my client's browser, they do these stepsSnooty
B
4

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" >
Bossy answered 27/8, 2014 at 21:24 Comment(1)
I just tried with FF 52 and clearing the cache from the network settings page as well as using "clear recent browsing history" from the privacy options did not touch the SQLite database, it was still there unchanged. Your 2nd comment "FF looks for the favicon in /var/www" has nothing to do with the subject here, that is just very simple and basic "URL science" and is a question of your individual webserver setup.Moron
D
4

I 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);
Dagda answered 2/2, 2016 at 14:45 Comment(0)
S
3

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

Shallop answered 4/2, 2017 at 14:50 Comment(5)
Yes that works just as well. I just tried both the tool I originally proposed and yours and the handling is pretty similar, although subjectively at least when I just tried, briefly, I liked the Firefox add-on a bit more, but there is not much of a clear difference.Moron
By the way, FYI: I took the liberty of removing the archive.org link to the URL I posted in my answer from the top of your answer since I included it into my answer myself now, thanks for the hint! I thought that this is okay since you explicitly stated that it was for the link in the "accepted answer", otherwise I would not dream of meddling with other people's texts in that way.Moron
Is this answer still valid after Firefox removed the interface of the SQLite engine? how to install sqlite manager addon in firefox quantum (browser version 57)Gaussmeter
@AhmedMostafaAbdel-Baky here you are directly editing SQLite files so I believe it should workShallop
This solution worked for me with Firefox 61 except that I had to open and edit the "favicons.sqlite" database file (instead of the "places.sqlite" db file).Katha
D
-3

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.

Doublehung answered 16/4, 2014 at 19:10 Comment(1)
Weirdly enough, the icon is shown in the bookmark menu. Just not on the tab.Flyer

© 2022 - 2024 — McMap. All rights reserved.