[TYPO3-dev] BrowserInfo going beserk...

Jigal van Hemert jigal at xs4all.nl
Sat May 22 15:39:42 CEST 2010


Steffen Kamper wrote:
> i didn't fully understand it, it seems that the (compatibility ...) is 
> part of every msie version, which seems to say "There is a compatibility 
> mode ..." - do you examined what really is sended in compatibility mode, 
> so how to detect?

My IE 8.0.6001.18904

Browser mode: IE8; Document mode: Standard settings for IE8
Detected*) as: Internet Explorer 8.0
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; 
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET 
CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)

Browser mode: Compatibility view IE8; Document mode: Standard settings 
for IE7
Detected*) as: Internet Explorer 8.0
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; 
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET 
CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
:: in this case only the first MSIE 8.0 changed to MSIE 7.0

Browser mode: IE7; Document mode: Standard settings for IE7
Detected*) as: Internet Explorer 7.0
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 
(compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; 
.NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
:: now the "Trident/4.0;" part is missing

IE8.0.6001.18702 on WinXP Pro VM

Browser mode: IE8; Document mode: IE8 standards
Detected*) as: Internet Explorer 8.0
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 
2.0.50727)
:: no compatible; MSIE 6.0; setting, but with Trident engine

I found the following 'strange' combinations also on the useragentstring 
website:

Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1; Trident/4.0; .NET CLR 
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 
3.0.4506.2152; .NET CLR 3.5.30729)
:: MSIE 5.5, but with Trident

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; 
chromeframe; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 
3.0.30729; Media Center PC 6.0; InfoPath.3)
:: MSIE 8.0 but with "chrome" in the UA

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.8pre) 
Gecko/20070928 Firefox/2.0.0.7 Navigator/9.0RC1
:: Netscape 9.0RC1 with "Firefox/<version>" in the UA; this happens with 
NS >= 9

Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 
Opera 9.70
:: Opera 9.70 with "Firefox/<version>" in the UA

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.65 [en]
:: Opera 8.65 width "MSIE 6.0 in the UA

Mozilla/5.0 (Linux; U; Ubuntu; en-us) AppleWebKit/525.13 (KHTML, like 
Gecko) Version/2.2 Firefox/525.13
:: really crazy. Seems to be Safari 2.2, but no trace of "safari" and 
the Firefox version is much higher than the current release

Conclusions:
============

MSIE has #msie\s([\d.a-z]*)#i
The left-most version found is correct, but if it is version 7.0 and 
there is 'Trident/...' in the UA then it is IE8 in compatibility mode.

Safari has often #safari([ /]((?<= |/)[\d.]*))?#i the last part is *not* 
the version however. Starting with version 2.2 it also has #version([ 
/]((?<= |/)[\d.]*))?#i (the last part is the version). Befor that 
version it may be the AppleWebKit/<version> which indirectly indicates 
the version number. Some versions of Safari do not have 'safari' in the UA!?

Chrome has #chrome/([\d.]*)#i and has so far always "safari" in the UA

Firefox has #firefox([ /]((?<= |/)[\d.a-z]*))?#i

Opera has #opera([ /]((?<= |/)[\d.]*))?#i and may have other browser 
names in the UA.


IE compatibility mode
=====================
The problem here is: how do you treat IE in compatiblity mode? It's like 
when you recognize uncle Jerry dressed up as Santa Claus when he comes 
to visit. Do you play along and treat him like Santa and ask him what he 
wants to drink, or will you immediately serve him his favourite drink 
(diet Coke)?
For statistics I would say IE8, for layout (loading different versions 
of CSS, JS, images, etc.) I would go for IE7. But how can this be solved 
for TS conditions?

*) detection by http://www.useragentstring.com/

-- 
Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh




More information about the TYPO3-dev mailing list