Recently, I was in the need of retrieving the favicon.ico file from a website. As I had to process the file programmatically and render it on a website, it would have been quite a lot of manual work to get the .ico file and make sure the browser does render it in the correct way. After digging around, I learned about a secret URI probably provided once by Google’s social bookmarking service Google Shared Stuff. While Google Shared Stuff was launched in 2007, it was already discontinued in 2009. However, this one URI seems to work perfectly maybe because it is still used within Google extensively.
The Secret
To get the favicon.ico file from any arbitrary page you simply have to use an URI using the following pattern:
http://www.google.com/s2/favicons?domain=www.example.org
Eventually, this URI will provide you the following image:
How it Works
Some More examples to see how it works:
- TechChrunch
- aheil blog
- dotnetpro Magazine
- heise.de
- Google+
As most of the sites do keep their favicon.ico file right in the root of the web site, others like Google don’t. Actually, you might find Google’s plus icon located at
https://ssl.gstatic.com/s2/oz/images/faviconr2.ico
While this is probably not a problem retrieving the favicon.ico file using the standard URI at all, the secret URI provides one major advantage: you’ll get the icon as a nice 16×16 PNG file, ready to be rendered in any <img> tag right away.
The Risk
As every time building up on a Google service as I did before, it might disappear tomorrow without notice leaving your site with quite a bunch of 404s though. Even worse, as it seems there is no official support for this URI, there won’t be any notice or deprecation period until switched of as done for other services like Feedburner.
essej
fulltimekiller
Grabicon (@GrabiconAPI)
Lee Andrew
Matthias
Hien Dang
Matthias
dactylium
praveen
Kyle Z.
Xerus
JK Baseer
andreas