[Typo3-dev] detecting mozilla, firefix and netscape

Martin T. Kutschker Martin-no5pam-Kutschker at blackbox.n0spam.net
Wed Sep 15 00:07:41 CEST 2004


Hi!

I've been looking at the code of t3lib_div::clientInfo and I'm wondering 
if it reports anything meaningful for "Mozillas".

This is the relevant code:

if (strstr($useragent,'Mozilla/4') || strstr($useragent,'Mozilla/5')) {
  $bInfo['BROWSER']='net';
}

case 'net':
  $bInfo['VERSION']= doubleval(substr($useragent,8));
  if (strstr($useragent,'Netscape6/')) {
   $bInfo['VERSION'] =
    doubleval(substr(strstr($useragent,'Netscape6/'),10));
  }
  if (strstr($useragent,'Netscape/7')) {
   $bInfo['VERSION'] =
    doubleval(substr(strstr($useragent,'Netscape/7'),9));
}
break;

Some sample user agent strings:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 
Netscape/7.02

Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) 
Gecko/20040628 Firefox/0.9.1

So this Netscape 7 will be reported with version "7.02".

OTOH, the Firefox will be reported as "5.0".

AFAIK any Firefox will behave as its open-source mozilla-twin, so the 
real Mozilla version is 1.7. There is no such thing as a 5.0 Netscape...

Should I go for subtyping? I need browser sniffing for resolving the 
escape/rawurlencode troubles. For this I need the versoin number of the 
new Mozilla code-base. In particular I'm looking for version 1.5.

Masi





More information about the TYPO3-dev mailing list