[Zope] Browser-Check with getBrowser(): set global var for request or call it in every html-page

Dylan Reinhardt zope at dylanreinhardt.com
Thu Nov 27 11:14:42 EST 2003


On Thu, 2003-11-27 at 00:53, Patrick Ulmer wrote:
> Hi,
> 
> i want to load different css for mozilla an explorer and found the nice 
> function getBrowser() on zope.org. But know I don't know, what is 
> possible or the better way to use it.
> 
> 1.) my idea is to call it from my index.html and set a cookie or if 
> possible a global var in zope for the request and use <dtml-if> for 
> loading the css
> 2.) i use it to create the right css in a python script
> 3.) i call it in every html-header over <dtml-let> and use <dtml-if> for 
> loading the right css
> 
> what is the best to fit to zope?

The easiest thing probably is to have three objects:

my_site.css
my_site.css_ie
my_site.css_mozilla

Have all your headers, etc., refer to my_site.css.  Set up my_site.css
as a method that makes a browser determination and returns either the ie
or mozilla content.

>From the client's standpoint, both versions live at the same address and
no cookies are required.  Since many clients will cache the css once
they get it, this may also be the lowest overhead choice.

HTH,

Dylan





More information about the Zope mailing list