How to use ASP to determine the type of client browser and operating system.

Source: Internet
Author: User
Tags client
Client | Browsers a lot of people are asking this question, and here's the answer:
-----------------------------------------
First she wants to use the ASP's Servervarialbles this collection. What role does he have in having such a http_user_agent in Servervarialbles? His role is to get the basic information of the client browser and the version of the operating system, such as what brand of browsers (IE and Netscape are generally), their version number, and so on, I use a program to explain her usage, the file named Checkbrowse.asp.
$U 2 Forum Rautinee original $
$http://u2bbs.126.com$
' ++++++++++++++ below is the body of the program +++++++++++++++++
<HTML>
<HEAD>
<TITLE> Browser Detection </TITLE>
</HEAD>
<BODY>
<%
Dim browsemsg,browseversion,systemversion
Browsemsg=request.servervariables ("Http_user_agent")
' +++++++++++ a basic function to discriminate the operating system +++++++++++
Function Systemcheck ()
If InStr (browsemsg, "Windows then")
systemcheck= "Windows 98"
else if INSTR (browsemsg, "Windows NT 4.0") then
systemcheck= "Windows NT 4.0"
else if INSTR (browsemsg, "Windows NT 5.0") Then
Systemcheck= "Windows NT 2000"
Else
systemcheck= "Unknown type"
End If
End If
End If
End Function
Because of the time reason I did not write the judgment Win95 and the Windows XP statement, the interest Netizen may
' Add yourself: '
' +++++++++++ End +++++++++++
If InStr (browsemsg, "MSIE") Then
Systemversion=cint (Mid (Browsemsg,instr (browsemsg, "MSIE") +5,1))
Response.Write "Your browser version is IE" &BrowseVersion& "<BR>"
Response.Write "Your operating system is" &systemcheck ()
End If
%>
</BODY>
</HTML>
----------------------------------------
Ok,enjoy it and good luck!



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.