判断终端是手机还是PC

<!---------------START----------------->
<%
HTTP_ACCEPT=LCase(Request.ServerVariables("HTTP_ACCEPT"))
HTTP_USER_AGENT=LCase(Request.ServerVariables("HTTP_USER_AGENT"))

Dim UserType

If InStr(HTTP_ACCEPT,"text/vnd.wap.wml")>0 Then
 UserType="Phone"
Else
 ArrayStr=Split("android,iphone,ipod,ipad,windows phone,wp7,symbian,symb,samsung,nokia,htc,motorola,blackberry,ucbrowser,ucweb,mqqbrowser,mini,mobi",",")
 For i=0 To UBound(ArrayStr)
  If InStr(HTTP_USER_AGENT,ArrayStr(i))<>0 Then
   UserType="Phone"
   Exit For
  End If
 Next
End If

If UserType="" Then
 UserType="PC"
End If

Response.Write UserType
%>
<!---------------END---------------->

 

参考:

http://hi.baidu.com/jakenlian/item/3da6f10e21f080e4f45ba640

http://www.zytrax.com/tech/web/mobile_ids.html

相关文章
相关标签/搜索