1 22 23 package de.laures.cewolf.taglib.util; 24 25 import javax.servlet.http.HttpServletRequest ; 26 29 public class BrowserDetection { 30 31 private final static String USER_AGENT_KEY = "user-agent"; 32 private final static String MSIE = "msie"; 33 34 private final static int IE = 0; 35 private final static int OTHER = 1; 36 37 public static final int getBrowser(HttpServletRequest request){ 38 String agent = request.getHeader(USER_AGENT_KEY); 39 if(agent == null || agent.toLowerCase().indexOf(MSIE) < 0){ 40 return OTHER; 41 } else { 42 return IE; 43 } 44 } 45 46 public static final boolean isIE(HttpServletRequest request){ 47 return getBrowser(request) == IE; 48 } 49 50 } 51 | Popular Tags |