views:

58

answers:

4

I'm seeing cases where the IE useragent string has multiple parts reporting to be different versions. For example:

   Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; 
   {B93AEBFF-7B72-44EA-B006-8CB078CC1911}; 
   Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; 
   .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; 
   .NET CLR 3.5.30729)

So this is claiming to be MSIE 8.0, but also MSIE 6.0 . Does this mean anything special? Is it a stock IE or is there something special about it?

I ask because I'm seeing strange behavior with the browser that reports multiple versions but not with another IE8.0 that claims a single version:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; 
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; 
.NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)

Not sure if the useragent has anything to do with it, but I thought I'd ask.

[Update] Note that I'm not coding against particular browser versions, I just noticed this as a difference between the browser that was behaving strangely and the ones that were not. I wanted to know what would cause some IE8.0's to report they're also IE6.0 others not.

A: 

People start coding against versions and then all future user-agent strings need to keep that version in their string or else things stop working.

Never code to user-agent string, code to capabilities:

http://yura.thinkweb2.com/cft/

Lou Franco
+1  A: 

Lou's answer is correct but I'll expand on it.

User agent strings is available to JavaScript code running on a web page. Unfortunately it's rather common (and bad) practice among web developers to check user agent string to perform browser-specific enhancements or workarounds.

When new browsers, with upgraded capabilities, were introduced, their developers realized that many web sites didn't work in them or worked in a degraded way, because user agent checks were done incorrectly and taking wrong paths in the code. This led browser developers to modify their user agent strings so that a correct path is taken. This led to current situation, where every browser pretends to be Mozilla and in general user agent strings are quite a mess.

It's therefore quite possible that a website that you see misbehaving is performing user agent check and not doing it right. As Lou said, JavaScript code shouldn't try to parse user agent (which is a very fragile way to test for a browser and very likely to break with future versions of the browser) but instead check for browser capabilities. Current popular JavaScript library (like jQuery) do it the right way (one more reason to use them) but it still happens that custom written JavaScript code will try to use user agent string.

Krzysztof Kowalczyk
I think you and Lou might be misinterpreting what he's saying. He isn't talking about the Mozilla 4.0 followed by the IE. He's getting two entirely separate user agents from one connection, as if someone pasted one after the other. That is pretty abnormal.
Conspicuous Compiler
A: 

The 6.0 version is actually inside the 8.0 version's parentheses. (Of course, neither is actually valid according to the HTTP grammar, but pretty much nobody treats it as a structured string these days.)

This post appears to be the only result for B93AEBFF-7B72-44EA-B006-8CB078CC1911, which is suspicious.

tc.