All over the world at this very moment, millions of browsers are attempting to download a file that doesn’t exist, will never exist, and never existed in the first place. Each time this happens, somebody has just visited a web page that makes absolutely no reference to this file, yet that is precisely the reason each browser tries to fetch it in the first place.
If this sounds, well, insane to you, it is. The name of this file is /favicon.ico. Originally the brainchild of Microsoft’s indomitable genius, this internet cane toad has come to be condoned by all of today’s major web browsers.
Long ago in an internet far, far away, a rather outrageous proclamation took place. The Internet Explorer (aka IE) team wanted to spice up the look of the “Favorites” menu by drawing cute icons next to the bookmarks listed there. Naturally, they wanted to offer web sites the ability to provide their own custom icons. That way, the brand of a web site could be displayed alongside any links its content.
To enable this feature, Microsoft suggested that web masters place a particular image file, /favicon.ico, in the document root of their site. If it was found to exist, it would be displayed it in IE’s bookmarks menu. If not, IE would show its default earth icon, or whatever that thing was.
Sounds innocent enough, right? Wrong. In effect, in one fell swoop, Microsoft declared /favicon.ico to be a reserved URL on all web sites for all time – past, present, and future. If a site didn’t have an icon, or its web master was unaware of this “feature”, their site gradually started to log more and more 404 errors as IE‘s rate of adoption grew.
It would have been bad enough had the madness stopped there. But soon, /favicon.ico started to show up in the address bar. Whenever somebody launched their browser and visited a site, an attempt would be made to fetch /favicon.ico and display it next to URL of the web page. In time, other browsers followed suit, enabling the situation we face now.
Every day an untold but staggering amount of internet bandwidth, CPU heat, and thumb twiddling is dedicated to the fetching of nothing. Legions of web servers find their logs strewn with vacuous 404’s telling of failed requests for /favicon.ico. An unhappy few even fight back with 410’s, begging for a reprieve that never comes, for no matter how many times a web site says “what part of 410 don’t you understand?!”, the browsers stubbornly start their day visiting sites with a dopey GET /favicon.ico.
What can be done about this? It’s hard to ask the browser vendors to reprogram this behaviour. The philosophy d’jour prescribes a strict covenant for new releases of web browser software: “Don’t break the web” – web sites should look and work the same after a new release as they did before. Lots of sites out there are now counting on browsers to fetch /favicon.ico to display their brand.
Therefore, going forward, it falls to noble efforts of developers and system administrators to slap /favicon.ico back to the stone age. Thankfully, the good folks at Mozilla have given us an out on the front end, and as far as I know, all the major browsers have adopted their proposal:
If a tag of the form <link rel="icon" href="URL to icon"> appears in the head of the markup, the browser will use that as the page icon and not fetch /favicon.ico. This is great in a number of ways. Web masters regain control over where to put their page’s icon artwork. Web pages regain control over instructing the browser what and what not to download.
Furthermore, web developers no longer have to use the tedious .ico format. They can use the superior PNG format, or GIF if they are losers. Of course, old browsers are stuck in the ways of the past and won’t be hip to this convention, but one day their existence will pass to a dreary memory.
I haven’t been able to find instructions on what to do if you don’t have icon or don’t care to show one. I’ve begun to use the following approach, which may be taboo because I’m referencing the void rather than an image. But it works (at least in Firefox and Safari) : <link rel="icon" href="">
This prevents the unwanted hits to my web server. In addition, I’ve applied the following apache configuration to the document root of my web site. Good luck and may the force be with you!
Redirect gone /favicon.ico
<FilesMatch "favicon.ico">
ErrorDocument 410 "unsupported"
</FilesMatch>