CSDN博客

img zhaohh

操作系统与浏览器的判断

发表于2005/1/3 13:46:00  445人阅读


Function getBrowser(ByVal logstr)
    logstr = Request.ServerVariables("HTTP_USER_AGENT")
    If InStr(logstr, "MSIE 6") <> 0 Then
        getBrowser = "IE 6.xx"
    ElseIf InStr(logstr, "MSIE 5") <> 0 Then
        getBrowser = "IE 5.xx"
    ElseIf InStr(logstr, "MSIE 4") <> 0 Then
        getBrowser = "IE 4.xx"
    ElseIf InStr(logstr, "Mozilla/3") <> 0 Then
        getBrowser = "NetScape 3"
    ElseIf InStr(logstr, "[en]") <> 0 Then
        getBrowser = "NetScape 4"
    ElseIf InStr(logstr, "Opera") <> 0 Then
        getBrowser = "Opera"
    ElseIf InStr(logstr, "NetAnts") <> 0 Then
        getBrowser = "NetAnts"
    ElseIf InStr(logstr, "Teleport") <> 0 Then
        getBrowser = "Teleport"
    ElseIf InStr(logstr, "WebTran") <> 0 Then
        getBrowser = "WebTran"
    ElseIf InStr(logstr, "WebZIP") <> 0 Then
        getBrowser = "WebZIP"
    Else
        getBrowser = "Other"
    End If
End Function

Function GetOS(ByVal logstr)
    logstr = Request.ServerVariables("HTTP_USER_AGENT")
    If InStr(logstr, "Windows 95") <> 0 Or InStr(logstr, "Win95") <> 0 Then
        GetOS = "Windows 95"
    ElseIf InStr(logstr, "Windows 98") <> 0 Or (InStr(logstr, "Win95") <> 0 And InStr(logstr, "Mozilla/4.0") <> 0) Then
        GetOS = "Windows 98"
    ElseIf InStr(logstr, "Win32") <> 0 Or InStr(logstr, "Windows 3") <> 0 Then
        GetOS = "Windows 3.x"
    ElseIf InStr(logstr, "Win98") <> 0 Then
        GetOS = "Windows 98"
    ElseIf InStr(logstr, "Windows NT 5.0") <> 0 Then
        GetOS = "Windows 2000"
    ElseIf InStr(logstr, "Windows NT") <> 0 Then
        GetOS = "Windows NT4"
    ElseIf InStr(logstr, "SUNOS") <> 0 Then
        GetOS = "SUN"
    ElseIf InStr(logstr, "Linux") <> 0 Then
        GetOS = "Linux"
    ElseIf InStr(logstr, "Mac_PowerPC") <> 0 Then
        GetOS = "Mac"
    Else
        GetOS = "Other"
    End If
End Function

0 0

相关博文

我的热门文章

img
取 消
img