cyScape's BrowserHawk4J is a JavaBean that will do exactly what you are
looking for.
It automatically detects the browser type and version for you. In addition
to that it also provides 40 other properties to tell you whether the
browser supports other things, such as file upload, style sheets, frames,
tables, sslkeysize, etc.
Here is an example servlet to demonstrate its use. If its not a ver 4
browser it redirects them. You could also check to make sure its IE or
Netscape v4 instead of just checking for Majorver > 4 using the
getBrowser() call:
import ...
import com.cyscape.browserhawk.*;
public class Redir extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
BrowserInfo b = BrowserHawk.getBrowserInfo(req);
if ( b.getMajorver() < 4)
res.sendRedirect("/older_versions.jsp");
out.println("<HTML> ver 4 browser code goes here </HTML>");
}
}
More info and examples at http://www.cyscape.com/products/bh4j
HTH,
Richard
> Hi there
>
> I would like to implementation reject mechanism to request from
> old browser version in my servlet.
> Did anyone have an existing function shared for serving such purpose.
> In addition, I can't find the version# when invoking
> getHeader(User-Agent) for MSIE (the return string doesn't include
> version#) while NS does, are there some other means to get the
> browser version?
>
> Thanx
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html