Posted: 4th January 2009

Favicons: You’re Doing Them Wrong

Categorized: common errors, html & css, images, web design, web development.

Favicons have been with us from the start of the Internet as we know it, but the vast majority of web authors are still using them wrong. Why? Our little friend the MIME is here to help.

Mime Types and the Internet

Officially Internet media type nowadays, the Mime type originated as a way of signifying additional files on email served via SMTP. Mime types are made up of two pieces of information: a type and then a subtype. Additionally, a charset parameter may inform of the character set of the file.

You will have used these before: when writing a HTML document, you’ve always written something like this:

<meta http-equiv="Content-Type"
  content="text/html; charset=utf-8"/>

The Mime type is the text/html bit.

Usually, when a web author links to a favicon on his page, he might define it as image/x-icon.

<link rel="shortcut icon"
  href="/favicon.ico" type="image/x-icon"/>

While this is strictly correct HTML, it is telling the browser that it is linking to a nonstandard, ICO image.

The problem is that ICO images have been standardized and registered with the IANA for 6 years, and you really have to start paying them their dues.

The correct Mime type for ICO images is image/vnd.microsoft.icon. Thus, a fully correct rendition of a link to a favicon would be something like this:

<link rel="shortcut icon"
  href="/favicon.ico" type="image/vnd.microsoft.icon"/>

Respect to the Mimes, people!

3 comments

  1. 1 lol@hotmail.com
    31st Mar 2009 at 11:47

    my dad sucks cock

  2. 2 Cyan-Light
    31st Mar 2009 at 19:58

    You know what? I could have guessed.

  3. 3 Me.
    31st Mar 2009 at 20:39

    Ahahahaha ugly.

Got something to say?

Say it like you mean it.

A link will appear with your name.

We don’t spam. Promise. Not even in theater.

Basic XHTML markup allowed. Or, well, HTML.