hi,

Don't rely entirely upon the user agent string. It will work only when
the client computer connects directly with your server. If it comes
through a proxy any of the following can happen

- the client machine gets a cached copy in the proxy cache. so it might get
the right version intended for it

- the proxy might send its own user agent like "mozilla (border manager/3.0)
when
a IE 5.0 browser might have made the actual request. In this case, the user
agent
detection logic will tell that the request is coming from a netscape
browser!

There are different variations of what these proxies can do!

Regards,
Nagarajan.

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Rajinder Sandhu
Sent: Tuesday, December 18, 2001 8:05 AM
To: [EMAIL PROTECTED]
Subject: Re: browswer check


<%@ import="java.io.*,java.util.*,java.lang.Object,java.text.Format" %>

<%
// using Java, determine if the browser is Netscape or MSIE
boolean isNetscape = false;

String userAgent = request.getHeader("User-Agent");
if ( userAgent.toLowerCase().indexOf("msie") ==-1   &&
userAgent.toLowerCase().indexOf("spoofer")==-1 )
{
   isNetscape = true; // browser is Netscape
}
else
{
   isNetscape = false; // browser is NOT Netscape
}
%>

Hope this helps.

Cheers!!
Raj



-----Original Message-----
From: Sami Saul [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 18, 2001 12:28 PM
To: [EMAIL PROTECTED]
Subject: Re: browswer check


Try request.getHeader("User-Agent")

Regards,

Sami

Can anybody direct me to some code that will check browser version and type
via jsp or tag?  I don't particularly want to use javascript.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to