tags:

views:

285

answers:

4

I am building a list of web Link to sites that I want to keep track of, and I would like to put the website icon, not the default browsers.

How can I do this?

+6  A: 

Open source HTML for a page in question. There you will find a link to the icon.

For example, for this very page you can see the following:

<link rel="shortcut icon" href="http://sstatic.net/so/favicon.ico"&gt;
<link rel="apple-itouch-icon" href="http://sstatic.net/so/apple-touch-icon.png"&gt;

If you mean to do it programmatically, then you need to parse HTML trying to find a link to the *.ico file in the HTML/HEAD section.

Developer Art
A: 

You should look for a .ico reference in the HEAD section of the HTML. For example, looking at the google website, I found this:

http://www.google.com/favicon.ico" type="image/x-icon"/>

which is exactly the google icon.

Hope this helps :)

MetalElf0
+12  A: 

A lot of sites put a favicon.ico file in the root so download the file "www.asite.com/favicon.ico" if it exists. I think legacy IE only supports a single favicon so that should get it most of them.

You could also try and check the link tags to see if there is on located somewhere specific.

eg:

<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico"&gt;

more on favicons here:

http://en.wikipedia.org/wiki/Favicon

Mark Redman
+1  A: 

Just a side note: getting the favicon is the right approach, but be forewarned that it's not as simple as it seems - see http://nick.typepad.com/blog/2008/11/favicon-hell-sm.html

Nick Bradbury