Exemple #1
0
 /**
  * Check does this browser type match the given UserAgent.
  *
  * <p>For example this would check if you are using Firefox: <code>
  * new Browser(userAgentString).isBrowser(UserAgent.FIREFOX)</code>
  *
  * @param agent the agent to check against this browser type
  * @return true if this browser type matches the agent
  */
 private boolean isBrowser(UserAgent agent) {
   if (agent != null) {
     // quick simple check by int covers most
     if (agent.match(browserType)) {
       return true;
     }
     // string check allows for odd browsers
     return agent.match(userAgentString.toLowerCase());
   }
   return false;
 }
Exemple #2
0
 /**
  * Check does this browser type match the given UserAgent and version.
  *
  * <p>For example this would check if you are using Firefox 8 or higher: <code>
  * new BrowserInfo(userAgentString).isBrowser(UserAgent.FIREFOX, 8, true)</code>
  *
  * @param agent the agent to check against this browser type
  * @param majorVersion the version to check against this browser type
  * @param atLeast whether the check should be equal (false), or equal or greater than (true)
  * @return true if a match for agent and version
  */
 public boolean isBrowser(UserAgent agent, int majorVersion, boolean atLeast) {
   return agent != null && agent.match(browserType, majorVersion, atLeast);
 }