File Under: Programming

Easily Add Favicons to Your Site

FaviconsChances are your blog has a ‘linked list’ to your favorite sites, or perhaps some links to your accounts on the online services you use — like Flickr, Delicious, Twitter, etc. You may have noticed that some bloggers add nice little icons next to such links to display the favicon of each site. It adds a little pizzaz to an otherwise dull list.

Unfortunately if you link to a .ico file from an img tag, Internet Explorer will choke and display nothing. However, it turns out that there’s an undocumented Google API that will automatically convert any domain’s .ico favicon to regular .png file, which IE can handle.

Since it’s undocumented, figuring out how use it is up to you. Luckily it’s not too hard, just add an image tag using this format:

Here’s a live example:

Webmonkey favicon

Hardly an earth-shattering discovery in a week where Google released a potentially web-altering browser, but handy nevertheless. The only real drawback is that it doesn’t seem to work if the domain in question stores its favicon somewhere other than the standard /favicon.ico location.

[via Simon Willison]