Tuesday, October 13, 2009

IE Favicon Not Showing Bug Fix

The first time a user visits your site, browsers automatically searches for this [favicon.ico] file in the root directory. Otherwise, when the favicon.ico does not exist, the error.log shows favicon.ico as "404 file not found". If your favicon.ico file is not located in the root directory, you probably have to specify the path way to favico.ico file.

All the other web browsers can load GIF or PNG format as favicon, but crappy IE. I browsed around (about 10 websites), got following result and rules from their source code.

If there exists a favicon.icon in the root directory, non-IE browsers automatically pick up it without having to specify the link tag inside the head tag.

To make sure IEs pick up your favicon
  1. Create a favicon.icon file, then locate favicon.ico file on your server (prefer  in the root directory, but you don't have to)
  2. Define this line inside head tag <link rel="shortcut icon" href="/favicon.ico" /> .