Linking to favicons

Favicons have been around for a few years now.  But they were mostly used by the browsers – in multi-tab environments and in bookmark managers.  Recently I’ve noticed the trend to use favicons in web design – next to external links or near the blog comment’s author, etc.

Adding a favicon to the design is a simple thing for the designer.  But a totally different story for the web developer.  Favicons can be either dropped into the root folder of the site or linked to from the page’s HTML.  On top of that, the times of the single favicon.ico format are long gone too.  These days you could get a GIF or PNG image.

So, how would reliably finda favicon of a site?  It turns out, you don’t really have to work too hard, since someone has already solved your problem.  From comments to this article (in Russian) I’ve learned of the Google web service.  So, all you’ll need to do is this (with whatever domain name that you need):

<img src="http://www.google.com/s2/favicons?domain=mamchenkov.net">

Works and sound good, right?  Wrong!  As I mentioned already, there is a way to link to favicons from HTML.  And this service doesn’t seem to take that into account.  Well, not to worry anyway.  There is another one that does – getFavicon.  This one works in a very similar way, but supports the full URL as a parameter.  For example:

<img src="http://g.etfv.co/https://mamchenkov.net/wordpress/">

On top of that, you can include properly encoded GET parameters, and avoid browser’s per-server connection limit, by using multiple sub-domains.  Brilliant, I say.

2 thoughts on “Linking to favicons”

Leave a Reply to inztinktCancel reply