com.gccloud.starter.common.utils.BrowserUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gc-starter-common Show documentation
Show all versions of gc-starter-common Show documentation
几乎所有的模块都依赖该模块,该模块中引入了一些常用工具类、通用的bean、全局异常处理、常量定义等
package com.gccloud.starter.common.utils;
/**
* @ClassName BrowserUtils
* @Description BrowserUtils
* @Author maoshufeng
* @Date 2020-03-11 9:35
* @Version 1.0
*/
public class BrowserUtils {
/**
* 获取浏览器版本
*
* @return
*/
public static String getBrowserName(String agent) {
if (agent.indexOf("msie 7") > 0) {
return "ie7";
} else if (agent.indexOf("msie 8") > 0) {
return "ie8";
} else if (agent.indexOf("msie 9") > 0) {
return "ie9";
} else if (agent.indexOf("msie 10") > 0) {
return "ie10";
} else if (agent.indexOf("msie") > 0) {
return "ie";
} else if (agent.indexOf("opera") > 0) {
return "opera";
} else if (agent.indexOf("opera") > 0) {
return "opera";
} else if (agent.indexOf("firefox") > 0) {
return "firefox";
} else if (agent.indexOf("webkit") > 0) {
return "webkit";
} else if (agent.indexOf("gecko") > 0 && agent.indexOf("rv:11") > 0) {
return "ie11";
} else {
return "Others";
}
}
}