getFavicon

Retrieves the relevant favicon for a URL, or returns a default icon should it not be able to find it. Works better than the Google version as it will find favicons specified by an HTML page's <link> element. Feel free to hotlink, although it would be nice if you could email me if you're going to make more than a couple of requests a second.

getFavicon's source is available at https://github.com/potatolondon/getfavicon

Instructions

To retrieve a favicon you can hotlink it at...

http://g.etfv.co/[URL]

Notice the URL contains the protocol (http or https). For example...

http://g.etfv.co/http://www.google.com

This works well in an <img> tag...

<img src="http://g.etfv.co/http://www.google.com" alt="Google" width="16" height="16" />

Escaping

Of course, you'll need to escape the URL you want the favicon for. E.g...

http://g.etfv.co/http://www.google.com/search%3Fq%3Durlencode

Default icon

You can specify a default icon to be displayed should the favicon not be found...

http://g.etfv.co/http://www.google.com?defaulticon=http://en.wikipedia.org/favicon.ico

You can also pass the following defaulticon values for other responses when a favicon isn't found:

HTTPS

You can request an HTTPS version like this...

https://getfavicon.appspot.com/http://www.google.com

Or get the secure icon for a domain like this...

http://g.etfv.co/https://encrypted.google.com

Multiple domains

To improve the performance of pages with many favicons on them you can overcome browser connection limits by pointing to the icon on different domains. You can see this in action on the test page (source) where we use the first letter of the domain to generate a subdomain name. The domains are of the format...

http://[whatever].getfavicon.appspot.com/[URL]

De-cache

You can remove an icon from the cache by calling /decache/?domain=[domain]. E.g. /decache/?domain=http://www.google.com.

Examples

More examples

1000 more examples on the test page.

Last cached icons

Stats

Updated every minute or so

Icons served
11951.05 million
Icons cached
91.03 million
Cache hit rate
94.36%
Unable to find favicon
35.77%

Implementations

Known problems

Credit

By Jason from Potato

Built using