Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

How do I include a "favicon.ico" on my Web pages?

An artist buddy of mine created a little favorites bookmark icon for my web site [they're properly called favicons or, if you want to use the name of the file, "favicon.ico" files] but I don't know how to specify on my pages that I have one of these favorites icons. Can you offer up the HTML I need?


Dave's Answer:

Wondering what we're talking about? Look up on the address bar of your Web browser right now and to the left of the actual URL of this page you should see a tiny little Dave icon, a nice little visual bookmark for the site that (I hope) doesn't appear on any other sites on the Web.

That's my "favicon.ico" and it looks like this:

favicon ico display

If you don't know how to create one for your own Web site or blog, check out the many, many matches for a Google search for 'how to create a favicon'. :-)

Now, once you have one, save it at the root level of your site, so that a URL like http://domain/favicon.ico works. Here's mine:

I used to include it in my Web pages with the following code:

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

but I found out that it's actually obsolete and there's a smarter, more XHTML legal and proper form, as detailed on the W3C site:

<link rel="icon"
  type="image/png"
  href="/somewhere/myicon.png" />

So to convert that to work on my site, my pages now have the following in the head:

<link rel="icon"
  type="image/png"
  href="/favicon.png" />

Note that I had to convert the ".ico" format to a more standard ".png" format for this to work, btw!

Also, please note that I am actually in the middle of this transition right now, so please don't leave a comment if you want to point out that it is NOT in fact what I have on the page at this moment in time. I'll fix it ASAP and all will be well. :-)

Hope that helps you out!



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Converting ico image to png is not necessary it might however be something to consider.

From the w3c "The format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. The format of the image must be one of PNG (a W3C standard), GIF, or ICO."

Posted by: Joe at May 14, 2009 3:43 PM

You can also use the type image/vnd.microsoft.icon if you're adding a favicon in blogspot blogs. Sometimes the rel shortcut icon doesn't work :(

Posted by: Jehzeel Laurente at May 15, 2009 10:26 AM

I cannot make it work with IE8.

Posted by: Livio Moreno at May 19, 2009 11:58 PM


THe code worked perfect, thanks very much for writing it down!

Cheers!!!

Posted by: sam at September 29, 2009 7:18 AM

"Also, please note that I am actually in the middle of this transition right now, so please don't leave a comment if you want to point out that it is NOT in fact what I have on the page at this moment in time. I'll fix it ASAP and all will be well. :-)"


What a long time that transition take, if you still are in the middle of it.

Posted by: Of cource at October 17, 2009 2:33 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Follow me on Twitter @DaveTaylor

Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Book Links
© 2002 - 2009 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.