I'd like to have a favicon appear in a visitor's browser tab and bookmarks when they visit my site. How can I accomplish that?
How can I have a favicon for my site appear in a visitor's browser?
favicon
Method 1 (HTML 4.01)You can use this code:<!DOCTYPE html       PUBLIC -//W3C//DTD HTML 4.01//EN      http://www.w3.org/TR/html4/strict.dtd><html lang=en-US><head profile=http://www.w3.org/2005/10/profile><link rel=icon       type=image/png       href=http://example.com/myicon.png>[]</head>[]</html>replace http://example.com/myicon.png with the actual URL of your favicon image.Method 2 (XHTML 1.0)<!DOCTYPE html   PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd><html  xmlns=http://www.w3.org/1999/xhtml   xml:lang=en-US  lang=en-US><head profile=http://www.w3.org/2005/10/profile><link rel=icon   type=image/png   href=http://example.com/myicon.png />[]</head>[]</html>As you can see the XHTML 1.0 version is very similar. And again, replace http://example.com/myicon.png with the actual URL of your favicon image.Method 3 (Predefined)A second method for specifying a favicon relies on using a predefined URI to identify the image: /favicon, which is relative to the server root. This method works because some browsers have been programmed to look for favicons using that URI. This approach is inconsistent with some principles of Web architecture and is being discussed by W3C's Technical Architecture Group (TAG) as their issue siteData-36. To summarize the issue: The Web architecture authorizes site managers to manage their URI space (for a given domain name) as they see fit. Conventions that do not represent community agreement and that reduce the options available to a site manager do not scale and may lead to conflict (since there is no well-known list of these predefined URIs). One practical consideration illustrates the problem: many users have Web sites even though they do not have their own domain name. These users cannot specify favicons using the second method if they cannot write to the server root. However, they can use method one to specify a favicon since it is more flexible and does not constrain the site manager to use a single favicon at a single place on the site.There are a few other well-known encroachments on URI space, including the robots.txt file and the location of a P3P privacy policy. The Technical Architecture Group is exploring alternatives that do not impinge on URI space without license.Source: http://www.w3.org/2005/10/howto-favicon