Why isn't my favicon showing up?

2019-06-16 17:45发布

问题:

Alright, so my favicon isn't showing up for some reason. It's at image/favicon.ico (I've checked like 5 times).

This is the code I use for it:

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

And this is the site: http://prime.programming-designs.com/

Edit: alright, I guess it's just my cashe.

回答1:

It's probably just cached in your browser, it shows up as a blue cross on mine.

Else, check your image path. image/favicon.ico isn't matching images/favicon.ico, but that is probably just a typo.



回答2:

Remove the cache of your browser and reboot the browser. Might take a while to show up in for example FF



回答3:

Late, however. I run into this problem more than I should. My fix is to add a 'version number' ?v1 or whatever, this will blow away cache.

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


回答4:

Most browsers like IE will request /favicon.ico despite what you have set, but it should still work if you return the proper Content-Type and made it the right way.

You can attempt to do:

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

The query string usually forces the browser to re-request the resource since it's unique.

You can also attempt to do a server redirect from /favicon.ico to /images/favicon.ico

You can also just move /images/favicon.ico to the root.

However, browsers naturally really, really cache the crap out of favicons so my suggestion would be to wait, as most likely none of the above would help. In time it should show up on your browser.



回答5:

  1. Load up http://prime.programming-designs.com/images/favicon.ico in your browser to 100% verify that the path is correct.
  2. Check the Content-Type header returned by the server. Some browsers might be oversensitive. You may have to register the MIME type for the .ico extension.
  3. As others have said, try clearing the browser cache.


回答6:

I just renamed favicon to favicon1 and uploaded the changed files and it worked.