Current location - Quotes Website - Collection of slogans - How to get the browser and operating system information of the client in jsp
How to get the browser and operating system information of the client in jsp
//Get the user's browser name stringusubrowser = st.nextken (); //Get the user's operating system name StringUserOS = st.nextken (); You can also get the information of this machine as follows: operating system information system. getproperty (OS. version); system . getproperty(OS . arch); Browser: Request. Getheader (user agent) request. Getheader ("user-agent ") returns the version number and type of the client browser, and getHeader(Stringname): obtains the header information of the transmission file defined by the http protocol. Request. GETMethod (): The methods to obtain the data transmitted from the client to the server include get, POST, PUT, etc. Request.getRequestURI (): get the client address of the request string, request.getServletPath (). : get the file path of the script file requested by the client. getServerName (): get the name requested by the server. getServerPort (): get the port number requested by the server. getRemoteAddr (): get the IP address requested by the client. getRemoteHost (): get the name of the client computer, and return the IP address of the client computer if it fails. getProtocol ():