Client의 웹브라우저 종류 조회



public static String getClntWebKind(HttpServletRequest request) throws Exception {

String user_agent = request.getHeader("user-agent");


// 웹브라우저 종류 조회

String webKind = "";

if (user_agent.toUpperCase().indexOf("GECKO") != -1) {

if (user_agent.toUpperCase().indexOf("NESCAPE") != -1) {

webKind = "Netscape (Gecko/Netscape)";

else if (user_agent.toUpperCase().indexOf("FIREFOX") != -1) {

webKind = "Mozilla Firefox (Gecko/Firefox)";

else {

webKind = "Mozilla (Gecko/Mozilla)";

}

else if (user_agent.toUpperCase().indexOf("MSIE") != -1) {

if (user_agent.toUpperCase().indexOf("OPERA") != -1) {

webKind = "Opera (MSIE/Opera/Compatible)";

else {

webKind = "Internet Explorer (MSIE/Compatible)";

}

else if (user_agent.toUpperCase().indexOf("SAFARI") != -1) {

if (user_agent.toUpperCase().indexOf("CHROME") != -1) {

webKind = "Google Chrome";

else {

webKind = "Safari";

}

else if (user_agent.toUpperCase().indexOf("THUNDERBIRD") != -1) {

webKind = "Thunderbird";

else {

webKind = "Other Web Browsers";

}

return webKind;

}



블로그 이미지

잉비니

,