Favicon

From Wiki @ Karl Jones dot com
Jump to: navigation, search

A favicon (short for Favorite icon), also known as a shortcut icon, Web site icon, tab icon or bookmark icon, is a file containing one or more small icons, most commonly 16×16 pixels, associated with a particular website or web page.

See also Favicon generator.

Description

A web designer can create such an icon and upload it to a website (or web page) by several means, and graphical web browsers will then make use of it.

Browsers that provide favicon support typically display a page's favicon in the browser's address bar (sometimes in the history as well) and next to the page's name in a list of bookmarks.

Browsers that support a tabbed document interface typically show a page's favicon next to the page's title on the tab, and site-specific browsers use the favicon as a desktop icon.

Support

All modern browsers support Favicons. There are differences between browsers.

HTML

<link rel="shortcut icon" href="http://www.yourwebsite.com/favicon.ico" />

History

In March 1999, Microsoft released Internet Explorer 5, which supported favicons for the first time.

Originally, the favicon was a file called favicon.ico placed in the root directory (e.g., http://en.wikipedia.org/favicon.ico) of a web site. It was used in Internet Explorer's favorites (bookmarks) and next to the URL in the address bar if the page was bookmarked.

A side effect was that the number of visitors who have bookmarked the page could be estimated by the requests of the favicon. This side effect no longer works, as all modern browsers load the favicon file to display in their web address bar, regardless of whether the site is bookmarked.

Standardization

The favicon was standardized by the World Wide Web Consortium (W3C) in the HTML 4.01 recommendation, released in December 1999, and later in the XHTML 1.0 recommendation, released in January 2000.

The standard implementation uses a link element with a rel attribute in the <head> section of the document to specify the file format and file name and location.

Unlike in the prior scheme, the file can be in any Web site directory and have any image file format.

In 2003, the .ico format was registered with the Internet Assigned Numbers Authority (IANA) under the MIME type image/vnd.microsoft.icon.

Ironically, when using the .ico format to display as images (e.g. not as favicon), Internet Explorer cannot display files served with this standardized MIME type. A workaround for Internet Explorer is to associate .ico with the non-standard image/x-icon MIME type in Web servers.

RFC 5988 established an IANA link relation registry, and rel="icon" was registered in 2010 based on the HTML5 specification. The popular <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /> theoretically identifies two relations, "shortcut" and "icon", but "shortcut" is not registered and is redundant. In 2011 the HTML living standard specified that for historical reasons "shortcut" is allowed immediately before "icon"; however, "shortcut" does not have a meaning in this context.

Legacy

Internet Explorer 5-10 supports only the ICO file format. Netscape 7 and Internet Explorer versions 5 and 6 browsers display the favicon only when the page is bookmarked, and not simply when the page is visited as in later browsers.

Browser implementation

The following table illustrates major web browsers supporting different features. The version numbers indicate the starting version of a supported feature.

File format support

The following table illustrates the image file format support for the favicon.

Browser ICO PNG GIF animated GIFs JPEG APNG SVG
Firefox Template:Yes<ref name="mozilla.9.6">Template:Cite web</ref> Template:Yes<ref name="mozilla.9.6" /> Template:Yes<ref name="mozilla.9.6" /> Template:Yes<ref name="ffbug">Template:Cite web</ref> Template:Yes Template:Yes<ref name="ffbug" /> Template:Yes<ref>Template:Cite web</ref>
Google Chrome Template:Yes Template:Yes Template:Yes Template:Yes Template:Yes Template:No Template:No<ref name="chromiumdev">Template:Cite web</ref>
Internet Explorer Template:Yes<ref name="jeffdavis" /> Template:Yes<ref name="ericlaw-1">Template:Cite web</ref> Template:Yes<ref name="ericlaw-1" /> Template:No<ref name="jeffdavis" /> Template:No<ref name="jeffdavis" /> Template:No<ref name="jeffdavis" /> Template:No<ref name="svg-request-ie">Template:Cite web</ref>
Opera Template:Yes<ref name="opera7">Template:Cite web</ref> Template:Yes<ref name="opera7" /> Template:Yes<ref name="opera7" /> Template:Yes<ref name="opera7" /> Template:Yes<ref name="opera7" /> Template:Yes Template:Dropped
Safari Template:Yes Template:Yes Template:Yes Template:No Template:Yes Template:No Template:No

Additionally, such icon files can be 16×16, 32×32, 48×48, or 64×64 pixels in size, and 8-bit, 24-bit, or 32-bit in color depth.

The ICO file format article explains the details for icons with more than 256 colors on various Microsoft Windows platforms.

Use of favicon

This table illustrates the different areas of the browser where favicons can be displayed.

Browser Address bar Address bar drop down list Links bar Bookmarks Tabs Drag to desktop
Firefox Template:Yes-No Template:Yes Template:Yes Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" />
Google Chrome Template:No<ref name="faviconic" /> Template:No Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref>Template:Cite web</ref>
Internet Explorer Template:Yes<ref name="faviconic" /> Template:No Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" />
Opera Template:Yes-No<ref name="faviconic" /> Template:No Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:Yes<ref name="faviconic" />
Safari Template:Yes<ref name="faviconic" /> Template:No Template:No<ref name="faviconic" /> Template:Yes<ref name="faviconic" /> Template:No<ref name="faviconic" /> Template:No<ref name="faviconic" />


Template:-

Opera Software added the ability to change the favicon in the Speed Dial in Opera 10.

How to use

This table illustrates the different ways the favicon can be recognized by the web browser.

Google Chrome Internet Explorer Firefox Opera Safari
<source lang="xml"><link rel="shortcut icon"
href="http://example.com/myicon.ico" /></source>
Template:Yes<ref name="msdn" /> Template:Yes<ref name="msdn" /><ref name="jeffdavis" /> Template:Yes<ref name="msdn" /> Template:Yes<ref name="msdn" /> Template:Yes
<source lang="xml"><link rel="icon"
type="image/vnd.microsoft.icon"
href="http://example.com/image.ico" /></source>
Template:Yes Template:Yes (from IE 9)<ref name="ericlaw-1" /> Template:Yes Template:Yes Template:Yes
<source lang="xml"><link rel="icon" type="image/x-icon"
href="http://example.com/image.ico" /></source>
Template:Yes<ref name="msdn" /> Template:Yes (from IE 9) Template:Yes<ref name="msdn" /> Template:Yes<ref name="msdn" /> Template:Yes
<source lang="xml"><link rel="icon"
href="http://example.com/image.ico" /></source>
Template:Yes Template:Yes (from IE 11) Template:Yes Template:Yes Template:Yes
<source lang="xml"><link rel="icon" type="image/gif"
href="image.gif" /></source>
Template:Yes Template:Yes (from IE 11) Template:Yes Template:Yes Template:Yes
<source lang="xml"><link rel="icon" type="image/png"
href="image.png" /></source>
Template:Yes Template:Yes (from IE 11)<ref name="ericlaw-1" /> Template:Yes Template:Yes Template:Yes
favicon.ico located in the website's root Template:Yes Template:Yes Template:Yes<ref>Firefox only accepts favicon.ico in the web site's root without a <link> tag if the setting browser.chrome.favicons is set to true in about:config. The default value is true. If set to false, these favicons are ignored.</ref> Template:Yes<ref>Opera loads /favicon.ico only if Multimedia/Always load favicon option in opera:config is set to 1. See Opera Support page for more details.</ref> Template:Yes
precedence: prefer root or (X)HTML linked version linked<ref name="faviconic" /> linked<ref name="faviconic" /> linked<ref name="faviconic" /> Template:Dunno Template:Dunno

If links for both PNG and ICO favicons are present, PNG-favicon-compatible browsers select which format and size to use as follows. Firefox and Safari will use the favicon that comes last. Chrome for Mac will use whichever favicon is ICO formatted, otherwise the 32×32 favicon. Chrome for Windows will use the favicon that comes first if it is 16×16, otherwise the ICO. If none of the aforementioned options are available, both Chromes will use whichever favicon comes first, exactly the opposite of Firefox and Safari. Indeed, Chrome for Mac will ignore the 16×16 favicon and use the 32×32 version, only to scale it back down to 16×16 on non-retina devices. Opera will choose from any of the available icons completely at random.

Only SeaMonkey doesn’t fetch favicon.ico files in the web site’s root by default.

Device support

For Apple devices with the iOS operating system version 1.1.3 or later, such as the iPod Touch, iPhone, and iPad, as well as some Android devices, it is possible to provide a custom icon that users can display on their Home screens using the Web Clip feature (called Add to Home Screen within Mobile Safari).

This feature is enabled by supplying a <link rel="apple-touch-icon" ...> in the <head> section of documents served by the web site. If the custom icon is not provided, a thumbnail of the web page will be put on the home screen instead.

The recommended basic size for this icon is 60×60 pixels; for best display on the higher-resolution iPhone 4 screen, an icon size of 120×120 pixels is recommended.<ref name="applewebclip" />

For the iPad and iPad 2, the basic size is 76×76 pixels. For the third-generation iPad, the high-resolution size would be 152×152 pixels.=

The icon file referenced by apple-touch-icon is modified to add rounded corners, drop shadow, and reflective shine.

Alternatively, an apple-touch-icon-precomposed icon may be provided to instruct devices not to apply reflective shine on the image.

With rounded corners, added by iOS
<link rel="apple-touch-icon" href="somepath/image.png" />
Without reflective shine
<link rel="apple-touch-icon-precomposed" href="somepath/image.png" />

No HTML is required by browsers or mobile devices to retrieve these icons, either.<ref name="allinthehead" /> The web site's root is the default location for the files apple-touch-icon-precomposed.png and apple-touch-icon.png (in order of priority).<ref name="applewebclip" /><ref name="allinthehead" />

HTML5 recommendation for icons in multiple sizes

The current HTML5 specification recommends specifying multiple sizes for the icons, using the attributes rel="icon" sizes="space-separated list of icon dimensions" within a <link> tag.

Multiple icon formats, including container formats such as Microsoft .ico and Macintosh .icns files, as well as Scalable Vector Graphics may be provided by including the icon's content type in the format type="file content-type" within the <link> tag.

As of iOS 5, Apple mobile devices ignore the HTML5 recommendation and instead use the proprietary apple-touch-icon method detailed above.

The Google Chrome web browser however, will select the closest matching size from those provided in the HTML headers to create 128×128 pixel application icons, when the user chooses the Create application shortcuts... from the "Tools" menu.

Animated favicons

Various browsers such as Chrome, Firefox and Opera support animation of favicons.

A bug has been open for Firefox since 2001 requesting a way to disable the feature.

Limitations and criticism

Due to the need to always check for it in a fixed location, the favicon can lead to artificially slow page-load time and unnecessary 404 entries in the server log if it is nonexistent.

The W3C did not standardize the rel-attribute, so there are other key words such as shortcut icon that are also accepted by the user agent.

Favicons are often manipulated as part of phishing or eavesdropping attacks against HTTPS webpages.

Many web browsers display favicons near areas of the web browser's UI, such as the address bar, that are used to convey whether the connection to a website is using a secure protocol like TLS.

By changing the favicon to a familiar padlock image an attacker can attempt to trick the user into thinking he or she is securely connected to the proper website.

Automated man-in-the-middle attack tools such as SSLStrip utilize this trick.

In order to eliminate this, some web browsers display the favicon within the tab whilst displaying the security status of the protocol used to access the website beside the URL.

See also

External links