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
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" />
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
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:
none: no default icon will be returned (and an HTTP 204 "No content" response code)1pxgif: 1px x 1px transparent GIFlightpng: grey 'world' icon (as used by Google Chrome)bluepng: light blue 'world' icon (as used by Google's favicon service)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
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]
You can remove an icon from the cache by calling /decache/?domain=[domain]. E.g. /decache/?domain=http://www.google.com.
1000 more examples on the test page.
Updated every minute or so