Do you have to include <link rel="icon" href="favicon.ico" type="image/x-icon" />?

user784637 picture user784637 · Jul 11, 2011 · Viewed 421k times · Source

I didn't include the following line of code in my head tag, however my favicon still appears in my browser:

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

What's the purpose of including it?

Answer

Brian Graham picture Brian Graham · Jul 11, 2011

If you don't call the favicon, favicon.ico, you can use that tag to specify the actual path (incase you have it in an images/ directory). The browser/webpage looks for favicon.ico in the root directory by default.