User:Sardisson/Gecko is Gecko
a rough draft of some thoughts on what to tell web designers and web application developers about browser sniffing and Gecko browsers
“Gecko is Gecko” or, A Guide for Web Designers and Web Application Developers who “Must” Sniff User-Agent Strings
Many designers and developers tailor their websites to specific browsers and then use user-agent sniffing to send different bits of code to different browsers. This is a poor practice for a number of reasons:
- Browsers you’ve never heard of
- Browsers that get renamed
- Robots and search engines
- ...
Developing for Web Standards
In a perfect world, authors would simply write for the web standards and every browser would just work. Unfortunately, we live in a world where all browsers have bugs and holes in their standards support (some more than others), and there are significant segments of the world's web users who continue to use older versions of browsers that are even more buggy and have more limited support for web standards than the current generation of browsers.
Pre-Publication Testing against Multiple Rendering Engines
In such a world, the next-best alternative is to test one’s site or applications against as large a number of popular rendering engines as possible, fix bugs in site or application code, and implement work-arounds for common browser bugs—and filing bug reports on the bugs with the browser developers.
“Runtime” Testing for Features
If for some reason this doesn’t work for your site or application—your site can “only” function with a particular user configuration or plug-in, for instance—test the user’s browser at “runtime” to see if it supports required function or configuration parameters.
User-Agent Sniffing
Finally, if the only solution available to you is sniffing the user-agent string and sending different codepaths to different browsers, you should sniff by rendering engine name and version, not by the user-agent (browser) using the engine.
About Gecko
For Mozilla-based browsers, this is Gecko, and “Gecko is Gecko”. Drivers, the group overseeing the Mozilla project, have taken a strong, clear stance that all Gecko-based browsers must support the same web technologies (fn a list of these?) in content area (regardless of whatever user interface or application features distinguish these applications in the mind of end-users). For a given Gecko version (the rv: value part of a Mozilla-based browser’s user-agent string), all browsers have the same capabilities, support the same technologies, and have the same bugs in the content area. Given identical fonts and settings (and with the exception of native widgets), all Gecko browsers sharing a Gecko major version (1.7, 1.8.0, etc.) should render a given page identically (if you find this is not the case, this is a serious bug and should be filed in Bugzilla). Thus authors should sniff—if sniffing is absolutely required—for Gecko and a particular Gecko version instead of the application name.
Sniffing for “Firefox” : Bad
For example, many sites currently sniff for “Firefox” (or perhaps “Firefox/1.0.x” or “Firefox/1.5.0.x”) and send those user-agents code tailored to Gecko’s capabilites and bugs (or Gecko 1.7.x’s or Gecko 1.8.0.x’s) and ignore other Gecko-based browsers, perhaps sending them code “tailored” for unknown user-agents, perhaps lumping other current Gecko browsers with archaic Netscape releases, or, in extreme cases denying entry, sending unstyled content, or the like. (Beginning in spring 2006, sniffing for “Firefox” will fail to detect development versions of Firefox, which will be branded differently and have user-agent strings to match this branding.)
Sniffing for “Gecko” : Better
Instead, with absolutely no additional work on the part of the author, the site could work correctly on dozens of other Gecko-based browsers on multiple operating systems and hardware configurations: Camino, Epiphany, Flock, Galeon, K-Meleon, SeaMonkey (and Mozilla 1.7.x and Netscape 8, for Gecko 1.7.x).
(this is a good thing)
(something about how the rv: compatibility works: 1.7.x, 1.8.0.x, 1.8.1.x, 1.9.x, with aN, bN)
(similar applies to WebKit on the Mac: Safari, OmniWeb, Shiira, Sunrise Browser..., and perhaps WinIE & derivatives?)
(add links as appropriate)
References
- Gecko [DevMo]
- Browser Detection Part Duh (will they ever learn?) [bclary.com]
- Browser Detection and Cross Browser Support [DevMo]
- Gecko Compatibility Handbook [DevMo]
- List of Gecko-based web browsers [Wikipedia]