Created
January 10, 2018 18:11
-
-
Save fromdev/4d89f1ff510ff33da5689b7ad70c001b to your computer and use it in GitHub Desktop.
Sample class how to use BrowserUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package browser.util; | |
import javax.servlet.http.HttpServletRequest; | |
import browser.util.BrowserUtil.BrowserType; | |
public class TestBrowserUtil { | |
public static void sample(HttpServletRequest request) { | |
String s = request.getHeader("user-agent"); | |
BrowserType bType = BrowserUtil.getBrowserType(s); | |
if (bType.equals(BrowserType.INTERNET_EXPLORER)) { | |
// Do IE stuff here | |
} else if (bType.equals(BrowserType.GOOGLE_CHROME)) { | |
// Do Chrome stuff here | |
} else if (bType.equals(BrowserType.UNKNOWN)) { | |
// DO generic stuff | |
} | |
// and so on.... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment