Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean when IE reports two versions in UserAgent?

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.

like image 700
Parand Avatar asked Aug 12 '10 00:08

Parand


People also ask

What is Trident in userAgent?

According to the UserAgentString.com website, my user agent string is Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko. Does this mean that I'm using Internet Explorer 11 with an Internet Explorer 7 user agent? UserAgentString.com states that "Trident" is the layout engine for Internet Explorer.

How do you read a user agent?

A User Agent (UA) string is a type of HTTP header request that contains information on the device. For example, if you browse the web on your smartphone, your device will send a HTTP request header to the web server, saying that it is a mobile device.

Why do all user agents start with Mozilla?

Why do so many browser user agents start with Mozilla? Mozilla was the name of the Netscape project and that was used as browser agent string. Some scripts checked that so that competing browsers used something Mozilla compatible (e.g. IE) and so all other browsers ended up using Mozilla with something.


1 Answers

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.

like image 62
Krzysztof Kowalczyk Avatar answered Oct 19 '22 08:10

Krzysztof Kowalczyk