favicon - the most correct & compatible way to add a favorite shortcut icon

The most compatible way to add a favicon is to use a self-closing link element with the rel property containing the words "shortcut" and "icon".

<link rel="shortcut icon" href="path/to/favicon.ico" />

The word "shortcut" is a workaround for Internet Explorer if you have an icon that is not named "favicon.ico" or to share the favicon for subdomains.

Lastly, you can omit specifying the favicon at the top of the page as long as your icon is named "favicon.ico" and is available at the root direction; e. g.: http://www.example.com/favicon.ico ...but using this method is not recommended as the page will load before the icon is displayed.

This post is available on GitHub.
Posted .


Leave a Reply