- 主题
- 0
- 积分
- 0
- 贝壳
- 0 个
- 注册时间
- 2006-11-29
- 最后登录
- 2006-11-29
|
ASP获取客户端操作系统及浏览器版本的两种方法
这是第一种,比较笨,需要收集各类OS及BROWER的AGENT标识';判断操作系统
Function OS()
Text=Request.ServerVariables("HTTP_USER_AGENT")
if Instr(text,"NT 5.2")>0 then
OS=OS+"Windows 2003"
Elseif Instr(text,"NT 5.1")>0 then
OS=OS+"Windows XP"
Elseif Instr(text,"NT 5")>0 then
OS=OS+"Windows 2000"
Elseif Instr(text,"NT 4")>0 then
OS=OS+"Windows NT4"
Elseif Instr(text,"4.9")>0 then
OS=OS+"Windows ME"
Elseif Instr(text,"98")>0 then
OS=OS+"Windows 98"
Elseif Instr(text,"95")>0 then
OS=OS+"Windows 95"
Elseif Instr(text,"Unix") then
OS=OS+"Unix"
Elseif Instr(text,"Linux") then
OS=OS+"Linux"
Elseif Instr(text,"SunOS") then
OS=OS+"SunOS"
Elseif Instr(text,"BSD") then
OS="BSD"
Else
OS=OS+"未知"
end if
End Function
';判断浏览器类型
Function Browser()
Text=Request.ServerVariables("HTTP_USER_AGENT")
if Instr(text,"MSIE 5.5")>0 then
Browser="Internet Explorer 5.5"
Elseif Instr(text,"MSIE 7.0")>0 then
Browser="Internet Explorer 6.0"
Elseif Instr(text,"MSIE 6.0")>0 then
Browser="Internet Explorer 6.0"
Elseif Instr(text,"MSIE 5.01")>0 then
Browser="Internet Explorer 5.01"
Elseif Instr(text,"MSIE 5.0")>0 then
Browser="Internet Explorer 5.00"
Elseif Instr(text,"MSIE 4.0")>0 then
Browser="Internet Explorer 4.01"
Else
Browser="未知"
End if
End Function 第二种
稍微好一点啦,可以自由识别OS及浏览器,不至于出现“未知”的情况。。。但还是有点不爽';获取用户OS,Brower信息
ClientStr=Request.ServerVariables("HTTP_USER_AGENT")
ClientStr=replace(ClientStr,")","")
ClientStr=replace(ClientStr,"(","")
ClientStr=replace(ClientStr,"MSIE","Internet Explorer")
ClientStr=replace(ClientStr,"NT 5.0","2000")
ClientStr=replace(ClientStr,"NT 5.1","XP")
ClientStr=replace(ClientStr,"NT 5.2","2003")
ClientInfo=split(ClientStr,";")
UserBrower=ClientInfo(1)
UserOS=ClientInfo(2) |
|