Favorite icons (browser tabs—what we're used to) Tthe e,G,Y or the Play on a red back ground to the left of the URL
http://www.jonathantneal.com/blog/understand-the-favicon/
When Alec Rust asked the HTML5 Boilerplate project to switch to a HiDPI favicon,
HiDPI (High Dots Per Inch) displays, also known by Apple's "Retina Display" marketing name, are screens with a high resolution in a relatively small format.They are mostly found in high-end laptops and monitors.
I realized how little I knew about favorite icons, touch icons, and tile icons. When I decided to dive in a little deeper, things got interesting.
Since they were first introduced by Internet Explorer in 1999, almost nothing about favicons has changed. They have almost-always been ICO files, either nested in the root of the domain as
The classic favicon.ico is a 16×16 ICO file, often served in either 16-color or 24bit alpha-transparency format. More recently, favicons have been served as 32×32, which is appropriately scaled down in all major and popular-legacy browsers. In IE10 Metro, the 32×32 icon is used in the address bar.
The rel attribute of a favicon is a product of evolution. Internet Explorer 5 intended
The type attribute of a favicon is about as useful as the type attribute of a . As of Janaury 16, 2013, Wikipedia hints that the favicon’s type attribute
may effect whether or not Internet Explorer will correctly display it.
In reality, Internet Explorer only cares about the server mime for the
ICO file, and otherwise ignores the type attribute. The type attribute
can be anything, and it can be nothing.
http://www.jonathantneal.com/blog/understand-the-favicon/
Understand the Favicon
When Alec Rust asked the HTML5 Boilerplate project to switch to a HiDPI favicon,
HiDPI (High Dots Per Inch) displays, also known by Apple's "Retina Display" marketing name, are screens with a high resolution in a relatively small format.They are mostly found in high-end laptops and monitors.
I realized how little I knew about favorite icons, touch icons, and tile icons. When I decided to dive in a little deeper, things got interesting.
Since they were first introduced by Internet Explorer in 1999, almost nothing about favicons has changed. They have almost-always been ICO files, either nested in the root of the domain as
/favicon.ico
, or organized by a CMS into a theme or images directory and displayed with:< link rel = "shortcut icon" href = "/path/to/favicon.ico" > |
The classic favicon.ico is a 16×16 ICO file, often served in either 16-color or 24bit alpha-transparency format. More recently, favicons have been served as 32×32, which is appropriately scaled down in all major and popular-legacy browsers. In IE10 Metro, the 32×32 icon is used in the address bar.
The rel attribute of a favicon is a product of evolution. Internet Explorer 5 intended
shortcut icon
to represent the relationship between the page and the icon, but when the specification separated relationships by space, this theoretically created two relationships, shortcut
and icon
. It wasn’t until 2010 when the HTML5 specification declared icon
alone to be the standard identifier. In non-IE browsers, favicons can be served without the shortcut
property.
< link rel = "shortcut icon" href = "path/to/favicon.ico" >
< link rel = "icon" href = "path/to/favicon.ico" > |
< link rel = "shortcut icon" href = "path/to/favicon.ico" type = "image/x-icon" >
< link rel = "shortcut icon" href = "path/to/favicon.ico" > Good news, everyone! Good browsers can use PNG favicons. Bad news, everyone! Chrome and Safari will use the ICO favicons anyway.This really depresses me, because Chrome, Firefox, Opera 7+, and Safari 4+ all accept the PNG favicon, but Chrome and Safari will opt to use the ICO favicon when both are presented, regardless of the order in which they are declared. On the other hand, Internet Explorer does not support PNG favicons, but it will ignore the PNG favicon and use the ICO favicon, regardless of the order in which they are declared.
And that’s just the beginning. Now it’s time to learn about the Internet Explorer caveats. While IE8-10 will display the favicon on first load of the page, IE7 will skip the first load and display the favicon during repeat visits. Worse yet, IE6 will only display the favicon once the site has been bookmarked and reopened in the browser. IE6 will also drop the favicon whenever the browser cache is cleared, and it will not display the favicon again until the site is either re-bookmarked, or the favicon is somehow reloaded. If IE6 and favicons mean a lot to you, you can force this reload with a little JavaScript snippet, preferably wrapped in a conditional comment.
Back to HiDPI; have you asked yourself this question yet? If all good browsers support PNG favicons, and IE browsers need ICO favicons, but ICO favicons throw off Chrome and Safari, why not wrap the ICO favicon in IE conditional commments?That is a great question, and it leads to a great idea. PNG files are a fraction the size of ICO files. We could serve a classic 32×32 ICO favicon to IE, and a super sleek 96×96 PNG favicon to everybody else.
Hey, hey — what if we stick the ICO favicon in the root directory and use
You. Win. The Internet! Given the limitations of Chrome, Safari, and
IE, this method will give every browser the best favicon experience. IE
will ignore the and use the ICO favicon found in the root of the domain as /favicon.ico . All other browsers will use the PNG favicon displayed with:
But what if I want multiple favicons or my CMS doesn’t like to do things this way? Is there … another way?Yea, but you’re not gonna like it.
With IE10 Metro we can display a unique tile icon when the visitor pins our site to their Start screen. These tile icons are 144×144 PNG files, and for best results they use a transparent background. A background tile color can be specified using a hex RGB color (using the six-character #RRGGBB notation), a CSS color name, or the CSS rgb() function. The markup is pretty simple.
Okay, so let’s put it all together, accepting the potential limitation of IE10, and keeping the sane parts of everything else.
If you want to learn more about creating favicons, I recommend Create the perfect favicon from Jon Hicks’ The Icon Handbook, and Making a good favicon by Jonathan Snook. Also, I want to thank @alrra for telling me about tile icons. Wait, I came here for touch icons.If you want to learn more about embedding touch icons, read Mathias Bynens’ Everything You Always Wanted To Know About Touch Icons. Or, follow this summary of his article:It’s perfectly possible to just create one high-resolution icon. Lower display resolutions automatically resize the icon. The downside is, this affects performance negatively whenever the site is added to the home screen.
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment