'Correct MIME Type for favicon.ico?
According to the Internet Assigned Numbers Authority (IANA), all .ico file falls under the MIME type image/vnd.microsoft.icon. (Source)
E.g.
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
However, savvy internet guru, Paul Irish, claims this is wrong, and that it would actually be image/x-icon. (Source)
E.g.
<link rel="icon" type="image/x-icon" href="favicon.ico" />
I know you can get away with not including a "type" for .ico files, but if you were going to include one, which should it be? Are there actually any problems with serving it as official IANA type?
Solution 1:[1]
I think the root for this confusion is well explained in this wikipedia article.
While the IANA-registered MIME type for ICO files is image/vnd.microsoft.icon, it was submitted to IANA in 2003 by a third party and is not recognised by Microsoft software, which uses image/x-icon instead.
If even the inventor of the ICO format does not use the official MIME type, I will use image/x-icon, too.
Solution 2:[2]
I have noticed that when using type="image/vnd.microsoft.icon", the favicon fails to appear when the browser is not connected to the internet.
But type="image/x-icon" works whether the browser can connect to the internet, or not.
When developing, at times I am not connected to the internet.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | mega6382 |
