String agent = request.getHeader("User-Agent");
if(agent.indexOf("Firefox") == -1 && agent.indexOf("MSIE") == -1) {
response.sendRedirect("error.html");
}
采用的策略就是setHeader("User-Agent" , "浏览器的值");
Firefox Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
IE Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2; CIBA)