Stefan,

Does anyone have ideas on how to detect WML or HTML browsers from the same site and redirect the user to the same directory using JSP ? I would greatly appreciate the help. Thanks.

What you want to do is look at the "accept" header. Here's the accept header that my browser sends:


text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1

The accept header contains the acceptable (and preferred) MIME types for the browser. I don't have a WAP browser handy, but I'm sure that it would have something like "text/wml" in there.

Some of the entries have ";q=some.number" after them. This is a weighting mechanism. This means that if you can serve both text/xml and text/html, then my accept header says that my browser prefers text/xml 10% more than text/html (no q= means q=1.0).

A WAP browser should probably send text/wml=1.0 or list it first on the accept header.

I wrote some code a while back that can parse the accept header and give you the mimetypes in preferred order, do matches, etc. Let me know if this might be useful, and I'll go look for it.

-chris


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to