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...
Notice the URL contains the protocol (http or https). For example...
This works well in an
<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...
You can specify a default icon to be displayed should the favicon not be found...
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 GIF
lightpng: 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...
Or get the secure icon for a domain like this...
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...
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