[Zope] Re: [Zope-dev] Get browser information from HTTP_USER_AGENT..

Paul Erickson erickson@kaivo.com
Mon, 26 Feb 2001 10:39:21 -0700


Remember, it sounds like "Netscape", but it's spelled like "Mozilla".

Put this line in a DTML method/doc and see what it tells you.

<dtml-var HTTP_USER_AGENT>

Konqueror: Mozilla/5.0 (compatible; Konqueror/2.1 Beta 2; X11)
Netscape: Mozilla/4.76 [en] (X11; U; Linux 2.4.1-1 i686)

-Paul

Pattreeya Tanisaro wrote:
> 
> Hello!
>         I would like to get the information about user's browser but when I
> add these following tags in my dtml header, the result from the third
> condition is always true.  (I checked with netscape and konqueror and the
> results were the same, Your browser is neither IE nor Netscape. )
> 
>         Thank you so much in advance for any suggestion.
> 
> <dtml-if "_.string.find(_['HTTP_USER_AGENT'], 'MSIE')  <> -1">
>     <link href="<dtml-var "msie_css.absolute_url()">" rel="stylesheet"
> type="text/css">
>         Your browser is IE.
>     <dtml-elif "_.string.find(_['HTTP_USER_AGENT'], 'NETSCAPE') <> -1">
>     <link href="<dtml-var "netscape_css.absolute_url()">" rel="stylesheet"
> type="text/css">
>         Your browser is Netscape.
>     <dtml-else>
>     <link href="<dtml-var "lw_global_css.absolute_url()">" rel="stylesheet"
> type="text/css">
>         Your browser is neither IE nor netscape.
>     </dtml-if>
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )

-- 
Paul Erickson       | erickson@kaivo.com
Kaivo, Inc.         | www.kaivo.com