20

My site is http://example.com/en/ I made a favicon for it. In the head I have:

 <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">

I can see the favicon.ico using the URL http://example.com/favicon.ico

But any browser doesn't show it. Help, please.

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
124bit
  • 496
  • 1
  • 3
  • 13

12 Answers12

23

Browser will load from cached data. Try updating your call to force an update via. new file-name.

<link rel="shortcut icon" href="/favicon.ico?v=2" type="image/x-icon">
Po Rith
  • 529
  • 4
  • 5
14

I see it used as icon when I browse to your page.

If you have visited your page before (duh!) it's likely because the browsers remember that there wasn't any icon there before, and don't update it right away. Browsers remember the icons for different sites, so that they don't have to request it every time that the site name is shown (for example in the bookmarks or the history).

Also, it's not guaranteed that every user sees the favicon, some browsers simply doesn't display some icons sometimes, for no apparent reason.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • @124bit: It seems that the only way is for the visitors to clean their histories: http://stackoverflow.com/questions/3970936/how-to-clear-ies-favicon-cache – Guffa Sep 30 '13 at 23:05
  • Actually, there is another way that is under developer control. Webservers can instruct browsers how long to cache any given file via the "Expires" and "max-age" headers. – Ananda Masri Aug 04 '21 at 02:03
3

I had the same problem. This is my favicon tag:

<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/>

Don't forget close it.

I cleaned browser cache, but it didn't fixed a problem.

I saw my favicon just after Chrome and Firefox restart. In my opinion, it's a strange hard browser caching

Antonio
  • 901
  • 5
  • 12
2

Takeaway from the Rest of the Similar Posts

It is Important to Close ALL the Windows for the Browser You Are Testing against and Start It Fresh to See the Change Happen. (Doesn't Work on Edge)

Aside Notes

I have stumbled upon this issue myself. After researching other answers, there are many suggestions to fix it.

Some people can't rid of the old icon: How to clear the icon cache of Chromium browser

Others wanted to force refresh: How do I force a favicon refresh

Community
  • 1
  • 1
1

CTRL+F5 can help in some cases as it will force-reload all elements on the page. Closing and opening a tab doesn't always help.

Developer Guy
  • 2,318
  • 6
  • 19
  • 37
Rob
  • 4,927
  • 4
  • 26
  • 41
1

Before doing anything, check your website in the browserling. If the favicon displayed there, you don't need to do anything further. At that moment, your browser decided to go crazy!

Ayub
  • 2,345
  • 27
  • 29
  • 1
    This is excellent advice if you might have some weird caching stuff going on. I had this issue and didn't want to redeploy my code just to fix the favicon. The most pragmatic approach for me, once I'd seen that the favicon was there and whilst I vaguely cared about updating it, was to update the link (by appending a querystring, like `favicon.ico?v=new` in the `head` section) ready for the next deploy. The more I care, the sooner the next deploy. – Tom Chantler Nov 24 '20 at 11:46
0

I had the same problem :

the favicon exists (you can access it by its url), but doesn't show up, wether I am in local (with WAMP) or on a real webserver.

I had the following code :

<link rel="icon" sizes="192x192" href="https://example.com/public/images/favicon/favicon.png" type="image/png">

The problem was that I had made some echo and var_dump of PHP variables before the <!DOCTYPE html> was displayed.

Once I had removed all the echo and var_dump, the favicon immediately worked on both local and web server.

droduit
  • 55
  • 1
  • 7
0

I experienced this as well. The quickest way for me usually is to paste the required link onto a different browser.

For example, if you are using Safari, run the link on Google Chrome. It works for me every time, without having to do the extra steps mentioned by others.

Juju
  • 17
  • 3
-1

try to use only rel="icon" in your rel... no rel="shortcut icon"

Rogi
  • 1
  • 3
-1

Po Rith's line of code worked for me. I added to the php page involved, escaping the quotes to accommodate the php, and it worked great.

echo "</head>"

became

echo "<link rel=\"shortcut icon\" href=\"/favicon.ico?v=2\" type=\"image/x-icon\"></head>"

Then used Ctrl+F5 to bypass the cache and load image fresh...worked right away.

Thanks, DougieC

-1

You can try this way. I had same issue.

<link rel="icon" href="favicon.ico?=1">
  • This is pretty much identical to the solution proposed in the [top rated answer](https://stackoverflow.com/a/42502012/). This isn't adding anything new or interesting. – Stephen Ostermiller Dec 12 '22 at 21:10
-1

You can add "?" at the end of the "favicon.ico" in code:

<link rel="icon" type="image/x-icon" href="favicon.ico?">
sonali
  • 762
  • 10
  • 23
  • This is pretty much identical to the solution proposed in the [top rated answer](https://stackoverflow.com/a/42502012/). This isn't adding anything new or interesting. – Stephen Ostermiller Dec 12 '22 at 21:10
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 16 '22 at 07:39