Draft in development; may change radically at any time.
Afavicon is a graphicimage (icon) associated with a particular Web page and/or Website. Many recent user agents (such as graphical browsers andnewsreaders) display them as a visual reminder of the Web siteidentity in the address bar or in tabs. The wikipedia includes anarticle aboutfavicons [FAVICON-WIKIPEDIA].
To add a favicon to your Web site, you'll need both an image and amethod for specifying that the image is to be used as a favicon. Thisdocument explains the method preferred by W3C for specifying thefavicon. There is another common method that is illustrated below,with an explanation of why that method is inconsistent with someprinciples of Web architecture. Both methods only apply to HTML andXHTML, one of thelimitations discussedbelow.
This document does not discuss in detail how to create a faviconimage. However, the format for the image you have chosen must be 16x16pixels or 32x32 pixels, using either 8-bit or 24-bit colors. Theformat of the image must be one ofPNG (aW3C standard), GIF, or ICO.
rel
attribute valuedefined in a profileThe first approach for specifying a favicon is to use therel
attribute value "icon" and to define what the value means via aprofile; profiles are discussed in more detailbelow. In this HTML 4.01 example, the favicon identified via the URIhttp://example.com/myicon.png
as being a favicon:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html lang="en-US"><headprofile="http://www.w3.org/2005/10/profile"><link rel="icon" type="image/png" href="http://example.com/myicon.png">[…]</head>[…]</html>
The XHTML 1.0 version looks very similar:
<!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"><headprofile="http://www.w3.org/2005/10/profile"><link rel="icon" type="image/png" href="/somewhere/myicon.png" />[…]</head>[…]</html>
A second method for specifying a favicon relies on using apredefined URI to identify the image: "/favicon", which is relative tothe server root. This method works because some browsers have beenprogrammed to look for favicons using that URI. This approach isinconsistent with some principles of Web architecture and is beingdiscussed by W3C'sTechnical Architecture Group(TAG) as their issuesiteData-36.To summarize the issue: The Web architecture authorizes site managersto manage their URI space (for a given domain name) as they seefit. Conventions that do not represent community agreement and thatreduce the options available to a site manager do not scale and maylead to conflict (since there is no well-known list of thesepredefined URIs). One practical consideration illustrates the problem:many users have Web sites even though they do not have their owndomain name. These users cannot specify favicons using the secondmethod if they cannot write to the server root. However, they can usemethod one to specify a favicon since it is more flexible and does notconstrain the site manager to use a single favicon at a single placeon the site.
There are a few other well-known encroachments on URI space,including the "robots.txt" file and the location of a P3P privacypolicy. The Technical Architecture Group is exploring alternativesthat do not impinge on URI space without license.
Loosely speaking, a profile is a definition of set ofterms. Ideally, a profile includes both machine-readable informationand human-readable information. In HTML 4.01 and XHTML 1.0, a fewattributes such as therel
attribute do not have a predefined set ofvalues. Instead, the author can provide values according to need, andthen use a profile to explain what the values mean. In our case, wehave recommend that authors use the value "icon" and a profile thatexplains that "when we say icon, we mean 'this is a favicon.'"
In Method 1 above, we use therel
attribute with theLINKelement and choose a profile with theprofile
attributeon the HEAD element.
We defined aprofile which you can freely use for your own sites.
There are several limitations to the approaches described above,including the preferred method (which is why the TAG continues to workon the question):
rel
. For more information on the use of profilesin HTML and XHTML, seeGRDDL[GRDDL].The following QA Interest Group participants and W3C staff havecontributed significantly to the content of this document:Dominique Hazaël-Massieux (W3C), Chris Lilley (W3C), andOlivier Théreaux (W3C).
Copyright © 2005, 2006W3C® (MIT,ERCIM,Keio), All Rights Reserved. W3Cliability,trademark,document useandsoftwarelicensing rules apply. Your interactions with this site are in accordancewith ourpublic andMember privacystatements.