Dr. Evil,

        I use exactly the method you suggest. I have  a servlet that checks
the first four characters of the user-agent. If it is  'Mozi', I call a JSP
to deal with an HTML request. If not then I assume WML and have different
JSPs for 'MOT-', 'SIE-',
'R380', 'Noki', etc.

Dave 



-----Original Message-----
From: Dr. Evil [mailto:[EMAIL PROTECTED]]
Sent: 23 October 2001 10:17
To: [EMAIL PROTECTED]
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

Reply via email to