简体   繁体   中英

Favicon not displaying

I am developing a site in PHP. The favicon is not displaying in Chrome and IE9.

I tried is:

'<link rel="icon" href="../images/Favicon.ico" />'

which works in Firefox.

There are much things that can make it not to work.

  • First of all check the path if its ok. Because your path leads to some directory outside the current one (../).
  • Icon file must be an icon not just image renamed to .ico
  • use ctrl+f5 to refresh your browser or clean all cache and close browser and try again or even try it in some other pc
  • favicon.ico should be always (the best is) in root directory

And to be sure you could use this both:

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

Hope it helps.

I had this similar issue and found that following the W3C recommendation : https://www.w3.org/2005/10/howto-favicon is the best way to do this.

<link rel="icon" type="image/png" href="favicon.png">

PS For some reason, the combination of type="image/x-icon" and href="favicon.ico" did not work for me, which is why I changed my icon to a .png file.

This works perfectly on IE11/ Firefox and Chrome.

For any favico(n), make sure in the source that it opens on a new tab / that the paths are right. Firefox usually "just displays it". If you don't see it for Chrome - when developing locally - right-click the refresh button and from the context menu, select "Empty cache and hard-reload".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM