|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.raj.extensions.BrowserDetector
Returns Browser information based on HttpServletRequest.getHeader("User-Agent").
Description : BrowserDetector File Name : browserDetector.java Author : Raj Bhaskar Author Email : raj_bhaskar@hotmail.com Created : Friday 1 March 2002 Last Modified : Friday 26 March 2002 Modified By : Raj Ported from the Weberdev.com PHP Source ##browserDetector() ##Parses User-Agent string into useful info ##Source: Weberdev.com ##Author: epsilon7 ##Author Email: epsilon7@asphyxia.com Ported from The Webmonkey JavaScript Source ##BrowserDetector() ##Parses User-Agent string into useful info. ##Source: Webmonkey Code Library ##(http://www.hotwired.com/webmonkey/javascript/code_library/) ##Author: Rich Blaylock ##Author Email: blaylock@wired.com
Usage:
Put the class on your classpath and load the bean:
<jsp:useBean id="sniffer" class="BrowserDetector" />
<jsp:setProperty name="sniffer" property="ua" value="<%=request.getHeader("User-Agent")%>' />
Properties: browser // Netscape, MSIE, Opera platform // Win95, Unix, Windows 98, Mac, PPC, etc. version // MajorVersion.MinorVersion majorver // Major Version (before . in version string) minorver // Minor Version (after . in version string)
These can be accessed <jsp:getProperty name="sniffer" property="<<ONE OF THE ABOVE>>" />
| Constructor Summary | |
BrowserDetector()
|
|
| Method Summary | |
java.lang.String |
getBrowser()
gets the browser (Netscape, MSIE or Opera) |
java.lang.String |
getMajorver()
gets the major version of this browser |
java.lang.String |
getMinorver()
gets the minro version of this browser |
java.lang.String |
getPlatform()
gets the platform that the browser is running on |
java.lang.String |
getVersion()
get the version of this browser |
void |
setUa(java.lang.String x)
stores the User Agent string in the object |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BrowserDetector()
| Method Detail |
public void setUa(java.lang.String x)
x - the user agent string to store (usually obtained through
HttpServletRequest.getHeader("User-Agent")public java.lang.String getBrowser()
public java.lang.String getPlatform()
public java.lang.String getVersion()
public java.lang.String getMajorver()
public java.lang.String getMinorver()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||