Favicon Markup: A Typo That Made Chrome Download Both Icons

Šime Vidas flagged a Twitter thread from subzey that turned up a small but wasteful markup mistake. The original favicon markup looked like this:

<!-- Warning! Typo! -->
<link rel="icon" href="https://css-tricks.com/favicon.ico" size="any">
<link rel="icon" href="https://css-tricks.com/favicon.svg" type="image/svg+xml">

That size attribute is a typo — it should be sizes, giving:

<!-- Correct -->
<link rel="icon" href="https://css-tricks.com/favicon.ico">
<link rel="icon" href="https://css-tricks.com/favicon.svg" type="image/svg+xml">

Once corrected, Chrome stopped double downloading both icons and used the SVG alone. The savings add up: the ICO file in question is 5.8kb, so every uncached page load now skips that download.

Šime covered the issue in Web Platform News #42, and noted that SVG favicons work in all modern browsers except Safari. As he puts it:

SVG favicons are supported in all modern browsers except Safari. If your website declares both an ICO (fallback) and SVG icon, make sure to add the sizes=any attribute to the ICO <link> to prevent Chrome from downloading and using the ICO icon instead of the SVG icon (see Chrome bug 1162276 for more info). CSS-Tricks is an example of a website that has the optimal icon markup in its <head> (three <link> elements, one each for favicon.ico, favicon.svg, and apple-touch-icon.png).

The author of the original markup, however, calls that callout overly generous: CSS-Tricks got there only after the error was pointed out. The typo seems to have originated in Andrey's article on favicon markup, which has since been fixed — and remains the best reference for practical favicon markup.