asp教程

asp如何判断浏览器类型及版本号

位置:首页 > asp教程 > asp技巧,2013-03-14
asp如何判断浏览器类型及版本号程序代码<%DimAgent,Browser,version,tmpstrAgent=Request.ServerVariables("HTTP_USER_AGE...
asp如何判断浏览器类型及版本号程序代码
<%
Dim Agent,Browser,version,tmpstr
Agent=Request.ServerVariables("HTTP_USER_AGENT")
Agent=Split(Agent,";")
If InStr(Agent(1),"MSIE")>0 Then
Browser="MS Internet Explorer "
version=Trim(Left(Replace(Agent(1),"MSIE",""),6))
ElseIf InStr(Agent(4),"Netscape")>0 Then
Browser="Netscape "
tmpstr=Split(Agent(4),"/")
version=tmpstr(UBound(tmpstr))
ElseIf InStr(Agent(4),"rv:")>0 Then
Browser="Mozilla "
tmpstr=Split(Agent(4),":")
version=tmpstr(UBound(tmpstr))
If InStr(version,")") > 0 Then
tmpstr=Split(version,")")
version=tmpstr(0)
End If
End If
response.Write(""&Browser&"  "&version&"")
%>

TAGS:asp判断浏览器

猜你喜欢

NewHot