[TYPO3-dev] BrowserInfo going beserk...

Jigal van Hemert jigal at xs4all.nl
Fri May 21 12:07:45 CEST 2010


Steffen Kamper wrote:
> Jigal van Hemert schrieb:
>> Steffen Kamper wrote:
>>> Jigal van Hemert schrieb:
>>>> Lars Houmark wrote:
>>>>> Jigal van Hemert wrote:
>>>>>> For the Install Tool I already proposed a change to Patrick Broens to
>>>>>> simply use conditional comments for the IE6/7 CSS, but this problem
>>>>>> still affects the Typoscript conditions for browser type and version.
>>>>>
>>>>> Browser detection was improved/changed very recently with RFC 
>>>>> #14230. You noticed that, right?
>>>>
>>>> I checked that RFC, but it only changed the Typoscript conditions, 
>>>> not the detection mechanism itself.
>>> wrong - the detection was changed completely.
>> Lars referred to RFC #14230. I just re-read it again (yes, so many 
>> times!) and only 
>> t3lib/matchcondition/class.t3lib_matchcondition_abstract.php was 
>> modified to allow matching with "all".
>>
>> It was #14201 which changed the detection. And this introduced the 
>> problem: "use the last one found (the right-most one in the UA). 
>> That's usually the most correct.")
>> Chrome has Safari as the right-most agent, MSIE 7/8 may have MSIE 6.0 
>> to the right of MSIE 7.0/8.0...
> again, the "browser" member is deprecated and only there for 
> compatibility reason. For correct detection the "all" has to be used.

Again, read the output of the function for IE8:

useragent : 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 : msie
version : 6.0
all : msie 6.0

"all" reports MSIE 6.0, which is obviously incorrect. The reason is 
simple: in "all" there is only a single entry per browser. Only the 
right-most version will be returned if the same 'browser' is present 
multiple times in the UA string.

Although this is easy to change (add an entry to "all" for each detected 
version), it still results in incorrect detection in TS. If you check 
for msie 6 it will match with some versions of IE8. You can blame the 
guys in Redmond for sending such a strange UA, but in the end the 
browser isn't detected correctly.
[browser= msie] && [version= 6] simply should not match for IE8.


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




More information about the TYPO3-dev mailing list