Search code examples
browsercompatibility

Preferred way to use favicons?


I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a favicon.ico file in the root of the website.

I found this nice little guide: How to Add a Favicon. However, the preferred method did not work in IE (7) and the second method is the old fashioned way (which I resigned myself to use).

Is there a third method that works across all the most popular browsers?


Solution

  • This is what I always use:

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

    The second one is for IE. The first one is for other browsers.