HTML and CSS Reference
The first of these snippets is known as conditional comments (an Internet Explorer-only [IE-only] feature),
whereas the second is known as UA sniffing because it tries to decipher the browser being used from the string
of information provided by the browser, called the userAgent .
Although using these snippets to determine how your application should act might have been a workable
solution in 2007, when accommodating three browser versions—IE6, IE7, and Firefox 2—would have accoun-
ted for nearly 95% of the market, the current round of browser wars have shaken things up dramatically, as
Figure 4-1: Desktop browser usage.
As of this writing, IE on the desktop has slipped to just more than 50% of the browser share and is split
between four different versions: IE6, IE7, IE8, and IE9, with IE10's release just around the corner. Chrome is
on the rise, now in the double digits; and Firefox, although declining a bit, is still more than 20%. Safari has
been slowly and steadily on the rise and may hit double digits in 2012 if Apple continues to roll. With the ex-
ception of IE, most users of other browsers are most likely to use a current version or one of the previous two
releases due to the way the browsers are now actively pushing auto-updates. IE has also rolled out auto-updates,
but users of older operating systems are limited to the browser they can use (IE6 for Windows 2000, IE8 for
Windows XP, and IE9 for Windows Vista).
Auto-update notwithstanding, taking into consideration still-in-use previous versions of all the browsers,
you're looking at more than 15 combinations of desktop browsers and versions that need to be supported. To
make things worse, this topic isn't talking primarily about desktop browsers, is it? On mobile devices the dom-
inant browser players in the United States are iOS and Android, with Firefox, Windows Phone 7 (WP7), Opera,
Symbian, and Blackberry also in the running. Add in a boatload of different devices and screen sizes, the rise of
the tablets, and fragmentation across Android, and your head should start to spin.
You could probably start writing conditional comments and doing browser sniffing right now and never stop
because new devices are released all the time.