You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dr. Evil" <dr...@sidereal.kz> on 2001/10/23 11:16:31 UTC

Opinions on detecting browser type for WML vs. HTML

I am working on a site where the same URL will be hit by both WML and
HTML browsers.  Fortunately, with Tomcat, it's very easy to have a
controller servlet which takes all incoming requests and decides to
forward them to various processors.  The problem is, how should I make
this servlet decide what to do?

It looks to me like basically every ordinary web browser in use
includes the string "Mozilla" somewhere in its browser type header.  I
believe this includes IE, Netscape, Konqueror, Galeon, Opera and
almost all the others.

My current thought is to check for the string "mozilla".  If it's
there, you get HTML, and if it's not there, you get WML.

Is this a reasonable approach?  I like to do things in a way that is
browser independent, but in this case I don't see how to do it.  There
really should be a header sent by the browser listing the MIME types
it accepts, perhaps, but there isn't so I don't know any other
alternative.

Thanks

Re: Opinions on detecting browser type for WML vs. HTML

Posted by simon <si...@lexues.co.jp>.
It's probably easier to spot the WAP browser rather than the other way around.  They send all sorts of goodies in their headers.
The 'user-agent' header always contains the string "UP.Browser" so you could search for that.  WAP browsers usually send the
'accept' header as well so you could use that to look for 'text/vnd.wap.wml'.

That's my opinion.  (I personally use the user-agent)


----- Original Message -----
From: "Dr. Evil" <dr...@sidereal.kz>
To: <to...@jakarta.apache.org>
Sent: Tuesday, October 23, 2001 6:16 PM
Subject: Opinions on detecting browser type for WML vs. HTML


>
> I am working on a site where the same URL will be hit by both WML and
> HTML browsers.  Fortunately, with Tomcat, it's very easy to have a
> controller servlet which takes all incoming requests and decides to
> forward them to various processors.  The problem is, how should I make
> this servlet decide what to do?
>
> It looks to me like basically every ordinary web browser in use
> includes the string "Mozilla" somewhere in its browser type header.  I
> believe this includes IE, Netscape, Konqueror, Galeon, Opera and
> almost all the others.
>
> My current thought is to check for the string "mozilla".  If it's
> there, you get HTML, and if it's not there, you get WML.
>
> Is this a reasonable approach?  I like to do things in a way that is
> browser independent, but in this case I don't see how to do it.  There
> really should be a header sent by the browser listing the MIME types
> it accepts, perhaps, but there isn't so I don't know any other
> alternative.
>
> Thanks
>