cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <>
Subject Re: [kinda OT] browser capabilities database
Date Thu, 19 Oct 2000 04:51:01 GMT
Hi Donald,

I'm working on extending Cocoon to have better support for WAP devices and
mobile devices in general. In order to do this I need to know what are the
browser capabilities and have them available in XSLT, so I can generate WML
appropriately. The way this is implemented is very generic and can be extended
to support any type of device, including Web browsers, iMode... you name it.

Right now the browser capabilities is static only, there's no way to get
dynamic properties from the browser, like whether JavaScript is enabled or not
and stuff like that. The browser capabilities is nothing else than an XML file.
Right now I use my own DTD for describing it but I plan to migrate to the
UAPROF format defined by the WAPForum:

I use an XSLT stylesheet that translates it to a Java class at compile time,
which is then executed when Cocoon starts up. (From I saw, in Cocoon2 this
class can be loaded at runtime.) This class maintains the database internally
and is used to pass the current browser capabilities as an XML document to the
XSLT processor. Thus you can make use of the capabilities in your XSLT
documents to generate the content that provides the best user experience for
that device.

My implementation replaces entirely the current browser support in Cocoon. It
also extends it by allowing the browser type to be determined by looking for
accepted MIME types in the Accept: header. This way unknown WAP or Web browser
types can be reasonably handled even if Cocoon doesn't know about them.

The current database contains only two WAP devices, however this will change in
the future as I plan to test with more mobile devices. Adding support for a new
browser is very simple so I hope people will start defining new browser types
very quickly.

So if you're looking for something available right now, this may not be for
you. If you're willing to add support for the browsers you're interested in, it
may be good enough for you.

I attach the browser capabilities file and an XSLT example of how you can use
it to generate the proper content.


Ovidiu Predescu <>  (inside HP's firewall only)

On Wed, 18 Oct 2000 23:38:23 -0400 (EDT), Donald Ball <> 

> hi guys. we're getting ready to launch our new corporate site, served by
> cocoon naturally, with both HTML and a DHTML skins. i've been tasked with
> the tricky problem of choosing the optimal skin for each user. my initial
> thought was to do client-side javascript detection, by testing to see if
> either document.layers or document.all exist and setting a cookie - not a
> perfect test, but a pretty good one. unfortunately, that approach only
> works if users enter the site via the splash page with the javascript, and
> if they allow me to set cookies.
> my next thought was to check the browser's user agent string against a
> capabilities database. unfortunately, i'm not aware of any such database
> that's open and maintained. php has support for a browscap.ini file, but
> they don't maintain it apparantly. you can download one sort of for free
> from a company, cyscape, but it's many months old, incomplete, and had
> some weird license restrictions. cyscape _does_, however have a javabean
> component called browserhawk which can tell you all sorts of information
> about a browser's capabilities, given an HttpServletRequest. pretty nifty,
> works well with all of the browsers i've tried, but it's not open, and
> it's not exactly cheap. (interestingly enough, it comes with an obfuscated
> version of ibm's xml4j parser - hope they licensed it legitimately!)
> i'm kind of torn. on the one hand, it's a great little component and it's
> got a comprehensive database (much better than their free browscap.ini
> file). on the other hand, it boggles my mind that there is no open browser
> capabilities database out there. am i missing one, is there in fact
> something good out there? if not, two questions:
> 1. would anyone be interested in helping start such a database and a set
> of libraries to access it?
> 2. will it be fairly straightforward to use a browser capabilities library
> (browserhawk or something else) to do flow control in the c2 sitemap?
> (e.g. apply this stylesheet if the browser supports DHTML, otherwise apply
> this one)
> thanks. i'm looking forward to apachecon so i can get a sitemap/c2 brain
> dump from those of you who've been working so hard on it.
> - donald

View raw message