<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>K-Squared Ramblings &#187; useragent</title>
	<atom:link href="http://www.hyperborea.org/journal/tag/useragent/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hyperborea.org/journal</link>
	<description>Sci-fi, comics, humor, photos...it&#039;s all fair game.</description>
	<lastBuildDate>Sat, 21 Nov 2009 07:49:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='www.hyperborea.org' port='80' path='/journal/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>What&#8217;s in a User-Agent String?</title>
		<link>http://www.hyperborea.org/journal/archives/2004/06/19/whats-in-a-user-agent-string/</link>
		<comments>http://www.hyperborea.org/journal/archives/2004/06/19/whats-in-a-user-agent-string/#comments</comments>
		<pubDate>Sun, 20 Jun 2004 06:50:29 +0000</pubDate>
		<dc:creator>Kelson</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[useragent]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.hyperborea.org/journal/archives/2004/06/19/whats-in-a-user-agent-string/</guid>
		<description><![CDATA[Some people browse collections. I collect browsers. Mostly I just want to see what they&#8217;ll do to my web site, but I have a positively ridiculous number of web browsers installed on my Linux and Windows computers at work and at home, and I&#8217;ve installed a half-dozen extra browsers on our PowerBook.
One project I&#8217;ve worked [...]]]></description>
			<content:encoded><![CDATA[<p>Some people browse collections. I collect browsers. Mostly I just want to see what they&#8217;ll do to my web site, but I have a positively ridiculous number of web browsers installed on my Linux and Windows computers at work and at home, and I&#8217;ve installed a half-dozen extra browsers on our PowerBook.</p>
<p>One project I&#8217;ve worked on since my days at UCI was a script to identify a web browser. In theory this should be simple, since every browser sends its name along when it requests a page. In practice, it&#8217;s not, because there&#8217;s no standard way to describe that identity.</p>
<p>Actually, that&#8217;s not quite true. There is a standard (described in the specs for HTTP&#160;1.0 and 1.1: <a href="http://www.faqs.org/rfcs/rfc1945.html">RFC&#160;1945</a> and <a href="http://www.faqs.org/rfcs/rfc2068.html">RFC&#160;2068</a>), but for reasons I&#8217;ll get into later, it&#8217;s not adequate for more than the basics, and even those have been subverted. That standard says a browser (or, in the broader sense, a &#8220;user agent,&#8221; since search robots, downloaders, news readers, proxies, and other programs might access a site) should identify itself in the following format:</p>
<ul>
<li>Name/version more-details</li>
</ul>
<p>Additional details often include the operating system or platform the browser is running on, and sometimes the language.</p>
<p>Now here are some examples of what browsers call themselves: <span id="more-380"></span> (If your browser supports the title attribute, you can hover the mouse cursor over each line to see what program it represents.  <b>Edit Aug. 19:</b> rearranged list for clarity and added a few more.  <b>Edit Sep. 11:</b> added the IE/WinXP SP2 example.)</p>
<ul>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/netscape_16.png)">Netscape Variations (non-Gecko)
<ul style="list-style-image: none">
<li title="Netscape 4.7 on Windows NT 4.0">Mozilla/4.7 [en] (WinNT; U)</li>
<li title="Netscape 4.72 on Linux">Mozilla/4.72 [en] (X11; U; Linux 2.4.18 i686)</li>
</ul>
</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/ie_16.png)">Internet Explorer Variations
<ul style="list-style-image: none">
<li title="Internet Explorer 5.01 on Windows NT 4.0">Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)</li>
<li title="Internet Explorer on a Mac">Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)</li>
<li title="Internet Explorer 6.0 on Windows XP">Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)</li>
<li title="Internet Explorer 6.0 on Windows 2000 with .NET 1.1">Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.1.4322)</li>
<li title="Internet Explorer 4.01 on Windows CE">Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240&#215;320)</li>
<li title="Internet Explorer 6.0 on Windows XP with Service Pack 2 security fixes and two versions of .NET">Mozilla/4.0 (compatible; MSIE&#160;6.0; Windows&#160;NT&#160;5.1; SV1; .NET&#160;CLR&#160;1.1.4322; .NET&#160;CLR&#160;1.0.3705)</li>
</ul>
</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/opera_16.png)">Opera Variations
<ul style="list-style-image: none">
<li title="Opera 6.0 on Mac OS X">Opera/6.0 (Macintosh; PPC Mac OS X; U)  [en]</li>
<li title="Opera 7.11 on Linux">Opera/7.11 (Linux 2.4.20-18.9 i686; U)  [en]</li>
<li title="Opera 7.50 on Linux">Opera/7.50 (X11; Linux i686; U)  [en]</li>
<li title="Opera 3.60 on Windows 2000">Mozilla/4.0 (Windows NT 5.0;US) Opera 3.60 [en]</li>
<li title="Opera 5.11 on Windows NT 4">Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 4.0) Opera 5.11  [en]</li>
<li title="Opera 7.50 on Windows XP">Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.50  [en]</li>
</ul>
</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/mozilla_16.png)">Gecko Browsers
<ul>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/mozilla_16.png)" title="Mozilla 1.3.1 on FreeBSD">Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030524</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/netscape_16.png)" title="Netscape 7.02 on Windows 2000">Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/camino_16.png)" title="Camino 0.7 on Mac OS X">Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1) Gecko/20030306 Camino/0.7</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/firefox_16.png)" title="Firefox 0.8 on Linux">Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040612 Firefox/0.8</li>
</ul>
</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/konqueror_16.png)">KHTML-Based
<ul>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/konqueror_16.png)" title="Konqueror 3.1 on Linux">Mozilla/5.0 (compatible; Konqueror/3.1; Linux)</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/konqueror_16.png)" title="Konqueror 3.2 on Linux">Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko) </li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/safari_16.png)" title="Safari 1.2 on Mac OS X">Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8</li>
</ul>
</li>
<li>Others
<ul>
<li title="Lynx 2.8.4">Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6h</li>
<li title="IBrowse 2.2 on Amiga">IBrowse/2.2 (AmigaOS V45)</li>
<li style="list-style-image: url(http://www.hyperborea.org/software/dillo/dillo16.png)" title="Dillo 0.8.1">Dillo/0.8.1</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/mosaic_16.png)" title="Mosaic 3 on Windows">NCSA Mosaic/3.0.0 (Windows x86)</li>
<li style="list-style-image: url(http://www.hyperborea.org/images/cs/omniweb_16.gif)" title="OmniWeb 4.2.1 on a Mac">Mozilla/4.5 (compatible; OmniWeb/4.2.1-v435.9; Mac_PowerPC)</li>
</ul>
</li>
</ul>
<p>The first thing you&#8217;ll probably notice is that most of these claim to be Mozilla. This is a holdover from the early days of the Browser Wars. <a href="http://www.netscape.com/">Netscape</a> was frustrated with what could be done with HTML&#160;2, and started building its own extensions. Web sites would check to see if the browser was Netscape (they used Mozilla as their code name) in order to decide whether to send the enhanced page or the plain one. Microsoft, hoping to get in on the Web action, wanted all of these sites to send the enhanced pages to their browser, so they identified it as Mozilla with a &#8220;compatible&#8221; note, and the real name in the comments.</p>
<p>So now you see things like <code>Mozilla/4.0 (compatible; MSIE&#160;5.22; Mac_PowerPC)</code> &#8212; which is not Netscape&#160;4.0, as the basic version states, but is actually Internet&#160;Explorer&#160;5.22.</p>
<p>Moving along, we find browsers like <a href="http://my.opera.com/community/download.pl?ref=Kelson&#038;p=opera_desktop">Opera</a>, which used the same reasoning as IE, but a different format: <code>Mozilla/4.0 (Windows&#160;NT&#160;5.0;US) Opera&#160;3.60 [en]</code>  So for Internet Explorer, you have to look inside the parentheses, right after the word &#8220;compatible.&#8221;  But for Opera, you had to look <em>after</em> the parentheses.</p>
<p>At the height of the Browser Wars, Netscape decided to release the source code for version 5 under an open-source license, allowing anyone to look at the code, modify their own copy, and suggest improvements or bug fixes. They called this code <a href="http://www.mozilla.org/">Mozilla</a>, to distinguish it from the finished Netscape browser. This was problematic, though, because putting Mozilla at the beginning would simply look like another version of Netscape. If you had Mozilla version 0.1alpha, you didn&#8217;t want it to look like it was really Netscape&#160;0.1, because then the server would assume you couldn&#8217;t handle things like JavaScript, frames, tables, plugins, etc. Netscape and Mozilla.org went through a number of different plans, finally <a href="http://www.mozilla.org/build/revised-user-agent-strings.html">settling on</a> using Mozilla/5.0 to start, putting the &#8220;real&#8221; Mozilla version at the <em>end</em> of the parentheses, then putting detailed build information and any &#8220;official&#8221; browser names (like Netscape, Beonex, Camino, Firefox, etc.) <em>after</em> the parentheses. So you end up with an ID like <code>Mozilla/5.0 (Windows; U; Windows&#160;NT&#160;5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02</code> for Netscape&#160;7.</p>
<p>Meanwhile, Netscape was losing ground to Microsoft. Netscape&#160;4 and IE&#160;4 were comparable, and Microsoft was bringing the full weight of marketing to promote their free-as-in-beer alternative. More importantly, Microsoft was relying on a basic human trait to do their work for them: laziness. By tying IE to Windows and making it the default web browser, they virtually guaranteed that the vast majority of people buying a new PC would start using IE. (This is not conjecture, this is fact: Microsoft was convicted of abusing their near-monopoly on the desktop to gain a monopoly on the web.)  And with Netscape&#160;5 delayed by rebuilding their code from scratch, IE&#160;5 easily surpassed Netscape&#160;4 both in technology and market share.</p>
<p>So at the end of the decade, Internet Explorer had become the prevalent web browser. People stopped testing pages in anything but Internet Explorer. Some of them were amateurs who didn&#8217;t know better, some were professionals who were frustrated by Netscape 4&#8217;s limitations or limited by deadlines or funding, and it became easier to just discount the shrinking Netscape market. Smaller projects, such as Opera (now the #3 browser) realized they needed a way to get into sites that blocked non-IE browsers. As a result, the default identification for Opera&#160;7.5 is <code>Mozilla/4.0 (compatible; MSIE&#160;6.0; Windows&#160;NT&#160;5.0) Opera&#160;7.50 [en]</code> &#8212; identifying itself simultaneously as Netscape 4, IE 6, and Opera 7. (Fortunately, Opera does allow you to set it to &#8220;do the right thing&#8221; and identify itself with the more sensible <code>Opera/7.50 (Windows&#160;NT&#160;5.0; U) [en]</code>.</p>
<p>But wait, it gets even better!</p>
<p>Enter Apple. Prudently realizing they might not want to rely on Microsoft for the default browser on the Macintosh, and also noticing that there were several high-quality rendering engines available to use as the basis of a new program, they settled on KHTML, the code used by KDE&#8217;s <a href="http://www.konqueror.org/">Konqueror</a> browser. KHTML, like Mozilla, had standards compliance as one of its goals, so they decided to leverage all the post-Mozilla 1.0 articles which recommended checking for the phrase &#8220;Gecko&#8221; to determine whether you could rely on the browser being able to handle advanced features that IE ignores. So their beta called itself <code>Mozilla/5.0 (Macintosh; U; PPC&#160;Mac&#160;OS&#160;X; en-us) AppleWebKit/60 (like Gecko) Safari/60</code>. People were appalled. Mozilla aficionados, already upset that Apple had chosen another program, complained that they were diluting the meaning of Gecko by using it on a browser that didn&#8217;t behave in exactly the same way. KDE fans complained that Konqueror would be further marginalized because people would start looking for &#8220;AppleWebKit&#8221; or &#8220;Safari.&#8221;  They eventually compromised by changing the wording to &#8220;KHTML, like Gecko&#8221; with the KDE people adding &#8220;KHTML&#8221; to Konqueror&#8217;s ID. Strangely, even now Safari doesn&#8217;t use its actual version number. Going by what it reports, you&#8217;d think it was Safari&#160;125.2.</p>
<p>So now there are at least four major places browsers put their real names:</p>
<ul>
<li>Name/version</li>
<li>Mozilla/x (compatible; name/version)</li>
<li>Mozilla/x (details; version)</li>
<li>Mozilla/x (details) more details name/version</li>
</ul>
<p>You&#8217;d think these would be enough, right?  Wrong. I&#8217;ve seen browsers use all of the following:</p>
<ul>
<li title="SkipStone 0.8.1 on Linux">Mozilla/5.0 (X11; U; Linux i686; en-US; SkipStone 0.8.1) Gecko/20020417</li>
<li title="Galeon 0.11.3 on Linux">Mozilla/5.0 (X11; U; Galeon; en-US; 0.11.3)</li>
<li title="Galeon... ? on Linux">Mozilla/5.0 (X11; U; Linux i686; en-US; Galeon) Gecko/20010701</li>
<li title="BrowseX on Linux">Mozilla/4.61 [en] (X11; U; ) &#8211; BrowseX (2.0.0 Linux 2.4.9-31)</li>
<li title="Linux on Cygwin on Windows 2000">Links (0.96; CYGWIN_NT-5.0 1.3.22(0.78/3/2) i686)</li>
</ul>
<p>Does the real name go in the middle of the parentheses?  At the end?  Before? After?  Is the version number put after a slash or a space?  Is it put in the parentheses instead?  Is it even there?  What were these people smoking?</p>
<p>So you can see, just figuring out the real name and version number of a browser is <em>far</em> from easy.</p>
<p>Now, suppose you want to identify what operating system it&#8217;s running. (Insert maniacal laughter.)  Let&#8217;s assume for the moment that you know <em>where</em> to look. Some of them are easy, like <code>Windows&#160;NT&#160;4.0</code> or <code>PPC&#160;Mac&#160;OS&#160;X</code> or <code>Linux&#160;i686</code> &#8212; or are they?</p>
<p>Somewhere around version 4, Netscape started identifying all Unix-like OSes as <code>X11</code> (since the program ran under the X windowing system), with another field to identify SunOS, BSD, Linux, etc. So for those, you need to look in two places. (And then there&#8217;s trying to pick out Solaris versions from SunOS&#8230;)</p>
<p>Then there&#8217;s Windows. You can spot <code>Windows&#160;NT</code> or <code>Windows&#160;98</code> but some of them are truly bizarre. Windows&#160;2000 claims to be NT&#160;5.0. Windows&#160;XP claims to be NT&#160;5.1. And Windows&#160;Me first claims to be Windows&#160;98, then adds an <em>extra</em> field identifying itself as <code>Win&#160;9x&#160;4.90</code> &#8212; really!</p>
<p>If you want to figure out whether the browser is running on a Mac, it might be in the form <code>Mac_PowerPC</code>, <code>PPC&#160;Mac&#160;OS X</code>, or <code>PPC&#160;Mac&#160;OS&#160;X&#160;Mach-O</code> (those are all from the same computer, by the way, using IE&#160;5.2, Safari, and Camino).</p>
<p>If all you need to know is whether your audience is using Windows, Macs, or something Unix-like, your best bet is to just look for <code>Win</code>, <code>Mac</code> or <code>X11</code>. Don&#8217;t look for <code>PPC</code> or <code>PowerPC</code> by itself, because you&#8217;ll catch people running <a href="http://ydl.net/">Yellow&#160;Dog Linux</a> or <a href="http://www.morphos-team.net/">MorphOS</a>.  (<b>Edit Aug. 19:</b> Or, it seems, Windows CE. See comments for more info.)</p>
<p>And trying to guess capabilities based on the browser&#8217;s (supposed) name is just asking for trouble. You&#8217;re better off testing based on actual capabilities. Want to support browsers that don&#8217;t have JavaScript? Use a <code>&lt;noscript&gt;</code> block. Want to send XHTML to browsers that can handle it and HTML to browsers that can&#8217;t? Check the Accept header. Worried about what what DHTML methods to use? Have your JavaScript check what&#8217;s available. </p>
<p>Unfortunately, trying to read the User-Agent name is like trying to read a map with no key.  You need to know what you&#8217;re looking for.</p>
<p>(Whew &#8212; finally posted that!  I started writing it a year ago, and found it in my Drafts folder today.)</p>
<hr /><small>Copyright &copy; 2009 Kelson Vibber and/or Katherine Foreman.<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. Permission granted to Planet Antispam and LiveJournal syndication feed ksquaredramblin.  If this content is not in your news reader or one of the sites listed above, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint: bc1c453a98ff79bab5c4fca2d890469d (38.107.191.90) )</small> <a href="http://www.hudson-family.co.uk/extremecorticate.php?source=673"></a>]]></content:encoded>
			<wfw:commentRss>http://www.hyperborea.org/journal/archives/2004/06/19/whats-in-a-user-agent-string/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>
