Necessary to add link tag for favicon.ico?

To choose a different location or file type (e.g. PNG or SVG) for the favicon:
One reason can be that you want to have the icon in a specific location, perhaps in the images folder or something alike. For example:

<link rel="icon" href="">

This diferent location may even be a CDN, just like SO seems to do with <link rel="shortcut icon" href="">.

To learn more about using other file types like PNG check out this question.

For cache busting purposes:
Add a query string to the path for cache-busting purposes:

<link rel="icon" href=""> 

Favicons are very heavily cached and this a great way to ensure a refresh.

Footnote about default location:
As far as the first bit of the question: all modern browsers would detect a favicon at the default location, so that’s not a reason to use a link for it.

Footnote about rel="icon":
As indicated by @Semanino’s answer, using rel="shortcut icon" is an old technique which was required by older versions of Internet Explorer, but in most cases can be replaced by the more correct rel="icon" instruction. The article @Semanino based this on properly links to the appropriate spec which shows a rel value of shortcut isn’t a valid option.

Leave a Comment