[Zope] Re: IE 5x lies about itself

Josef Meile jmeile@hotmail.com
Thu, 13 Feb 2003 12:35:16 +0100


--- In zope@yahoogroups.com, David Bear <David.Bear@a...> wrote:
 > I've been trying to conceptualize how I could select content
 > FORMATTING based on the browser that connects.  My thought was to use
 > the request.HTTP_USER_AGENT and see about parsing and selecting there.
 >
 > The ugly thing is that IE starts out saying its mozilla.  here's the
 > results of various UA strings.
 >
 >
 > IE 5.5
 > Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)
 >
 > IE 6.0
 > Mozilla/4.0 (copmatible; MSIE 6.0, Windows NT 5.0)
 >
 > Netscape 4.7
 > Mozilla/4.79 [en] (Windows NT 5.0; U)
 >
 > Real Mozilla
 > Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020721
 >
 > So, has anyone implemented a browser switch method thats easily
 > understood?  I'd like to select a different template based on the
 > browser.  Ergo, server side control instead of sending a load of
 > javascript.. (I know, browsers can lie)
I just made a how-to with the code I use:
http://www.zope.org/Members/jmeile/browserDetector

It works with Netscape >=4, Microsoft Internet explorer, Opera, Galeon, 
Konqueror, lynx, links, wget and Mozilla/gecko compatible browsers. With 
the rest you will see browser='unknown', version='0'. If you want more 
browsers, you'll have to add them.

Regards,
Josef.