受欢迎的博客标签

在设备“HM2013022”上测试各种浏览器的User Agent 大全

Published

以下为在设备“HM2013022”上测试各种浏览器的User Agent。 测试结果使用DOM/JS接口window.navigator.userAgent获得。

QQ Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 V1_AND_SQ_4.6.1_9_YYB_D QQ/4.6.1.2110

微信Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 MicroMessenger/5.2.380

搜狐微博客户端Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

腾讯微博客户端Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

新浪微博客户端Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30Xiaomi-2013022__weibo__4.2.6__android__android4.2.1浏览器(默认)Mozilla/5.0 (Linux; U; Android 4.2.1; zh-cn; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 XiaoMi/MiuiBrowser/1.0浏览器(桌面版)Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24 XiaoMi/MiuiBrowser/1.0浏览器(iPhone)Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3 XiaoMi/MiuiBrowser/1.0浏览器(iPad)Mozilla/5.0 (iPad; U; CPU OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25 XiaoMi/MiuiBrowser/1.0UC浏览器(默认)Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; 2013022 Build/HM2013022) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.2.0.308 U3/0.8.0 Mobile Safari/534.31UC浏览器(无)(无)UC浏览器(Chrome)Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.31 (KHTML, like Gecko) Chrome/17.0.558.0 Safari/534.31 UCBrowser/9.2.0.308UC浏览器(iPhone)Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5 UCBrowser/9.2.0.308ChromeMozilla/5.0 (Linux; Android 4.2.1; 2013022 Build/HM2013022) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36Chrome(桌面版)Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Safari/537.36FirefoxMozilla/5.0 (Android; Mobile; rv:26.0) Gecko/26.0 Firefox/26.0Firefox(桌面版)Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0欧朋浏览器(Android(默认))Mozilla/5.0 (Linux; U; Android 4.2.1; zh-CN; 2013022 Build/HM2013022) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Oupeng/9.1.0.70226 Mobile Safari/534.30 (securitypay,securityinstalled)欧朋浏览器(iPhone)Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Oupeng/9.1.0.70226 Mobile Safari/534.30 (securitypay,securityinstalled)欧朋浏览器(iPad)Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Oupeng/9.1.0.70226 Mobile Safari/534.30 (securitypay,securityinstalled)欧朋浏览器(电脑) Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Oupeng/9.1.0.70226 Safari/534.30 (securitypay,securityinstalled)

另外通过接口window.navigator.platform获得的结果:

UC浏览器为:Linux,ARM7

其它浏览器为:Linux armv7l

结论:

以上经过测试的浏览器中,以移动设备模式(包括iPad模式)浏览时,User Agent字符串中总会包含关键字“Mobile”,以桌面模式(电脑版)浏览时,User Agent字符串中都不含“Mobile"。

 第二篇 判断UA这种事不能说的太明。  

【微博】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 【

chrome】 Mozilla/5.0 (Linux; Android 4.2.2; GT-I9502 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.64 Mobile Safari/537.36 【猎豹】 Mozilla/5.0 (Linux; Android 4.2.2; GT-I9502 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.64 Mobile Safari/537.36 【海豚】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 【UC】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-CN; GT-I9502 Build/JDQ39) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/9.4.2.365 U3/0.8.0 Mobile Safari/533.1 【baidu】 Mozilla/5.0 (Linux; U; Android 4.2.2; zh-cn; GT-I9502 Build/JDQ39) AppleWebKit/534.24 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.24 T5/2.0 baidubrowser/4.2.13.3 (Baidu; P1 4.2.2) 【QQ】 MQQBrowser 【搜狗】 SogouMSE, SogouMobileBrowser 【小米】 XiaoMi/MiuiBrowser 【遨游】 Maxthon

【欧朋】 Opera, Oupeng --------------------------------------

/* function check_useragent(){  var bool_result='success';  var pattern=/micromessenger|360browser|360|MQBrowser\/(.*?)\s+\(iPhone;|Mozilla\/(.*?)\s+\(iPhone;|sina_weibo/i;  var useragent='<?php echo strtoupper($_SERVER['HTTP_USER_AGENT']);?>';  var referer = '<?php echo strtoupper($_SERVER['HTTP_REFERER'])?>';  if(useragent.indexOf(('360ee').toUpperCase()) != -1 || useragent.indexOf(('360se').toUpperCase()) != -1) {  // location.href= "http://pc.huochepiao.360.cn";   return;  }  if(!useragent.match(pattern)){   bool_result=useragent.indexOf(('Android').toUpperCase())==-1?'failed_pc':'failed_mb';  }  return bool_result;  } <?php if(@$_SERVER['SERVER_NAME']!='10.16.15.227'&&@$_SERVER['SERVER_NAME']!='12306.com'){?>  var sta=check_useragent();  if(sta=='failed_pc'){   if(navigator.userAgent.indexOf('iPhone')>-1){    location.href='error.html?pc';   }else{    location.href='errorpc.html';   }  }  else if(sta=='failed_mb'){   if(referer.indexOf('weibo.cn') > -1) {   if(navigator.userAgent.indexOf('MQQBrowser')>-1 || navigator.userAgent.indexOf('SogouMSE')>-1 || navigator.userAgent.indexOf('SogouMobileBrowser')>-1 || navigator.userAgent.indexOf('XiaoMi')>-1 || navigator.userAgent.indexOf('MiuiBrowser')>-1 || navigator.userAgent.indexOf('Maxthon')>-1 || navigator.userAgent.indexOf('Opera')>-1 || navigator.userAgent.indexOf('Oupeng')>-1  || navigator.userAgent.indexOf('UCBrowser')>-1){    location.href='error.html?mb';   }   } else {    location.href='error.html?mb';   }  } <?php }?>  */

  第3篇 由于移动流量日趋增多,我们统计网站流量的时候,需要把移动和PC的流量分开,而遇到百度蜘蛛的时候,为了更好更细的统计,也需要把百度蜘蛛的移动端和PC端分别来统计,这对网站分析有着非常重要的意义。

本文提供判断百度移动蜘蛛和百度PC蜘蛛的源代码,有php、asp、asp.net三个版本。 php版 <?php $ua=$_SERVER['HTTP_USER_AGENT']; $ua=strtolower($ua); if($ua!="" && strpos($ua,"baiduspider")){ if(strpos($ua,"android") || strpos($ua,"mobile")){ echo "是百度移动UA"; }else{ echo "是百度PCUA"; } } else{ echo"不是baiduspider UA"; } ?> 这个代码比较简单一点,这里为大家推荐看下这篇文章http://www.jb51.net/article/72211.htm。   asp版 <% ua=Request.ServerVariables("HTTP_USER_AGENT") ua=LCase(ua) if ua<>"" and InStr(ua,"baiduspider")<>0 then if InStr(ua,"android")<>0 or InStr(ua,"mobile")<>0 then response.write "是百度移动 UA" else response.write"是百度PC UA" end if else response.write "不是baiduspiderUA" end if %> 继续为大家推荐个asp中判断是否为搜索引擎的代码: function isspider() dim i,agent,searray agent="agent:"&LCase(request.servervariables("http_user_agent")) searray=array("googlebot","baiduspider","sogouspider","yahoo","Sosospider") isspider= false for i=0 to ubound(searray)  if (instr(agent,searray(i))>0) then isspider=true next end function asp.net string ua = Request.ServerVariables["HTTP_USER_AGENT"]; ua=ua.ToLower (); if(ua != "" && ua.IndexOf("baiduspider") > -1){ if (ua.IndexOf("android") > -1 || ua.IndexOf("mobile") > -1) { Response .Write("是百度移动 UA"); } else{ Response .Write("是百度PC UA"); } } else{ Response .Write("不是baiduspiderUA"); } string agent = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]; if (agent == null) { Response.Write("Other"); } else { Response.Write(agent); }   以上demo是通过ua来判断来访者是否Baiduspider,是比较普遍的方法。  

浏览器UA大全 1、主要浏览器 safari 5.1 – MACUser-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50safari 5.1 – WindowsUser-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50IE 9.0User-Agent:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;IE 8.0User-Agent:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)IE 7.0User-Agent:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)IE 6.0User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)Firefox 4.0.1 – MACUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1Firefox 4.0.1 – WindowsUser-Agent:Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1Opera 11.11 – MACUser-Agent:Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11Opera 11.11 – WindowsUser-Agent:Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11Chrome 17.0 – MACUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11 2、国产浏览器 MaxthonUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)TTUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler 4.0)The World 2.xUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)The World 3.xUser-Agent:?Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; The World)搜狗浏览器 1.xUser-Agent:?Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X MetaSr 1.0; .NET CLR 2.0.50727; SE 2.X MetaSr 1.0)360SEUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)AvantUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser)Green BrowserUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)

3、移动设备端 safari iOS 4.33 – iPhoneUser-Agent:Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5safari iOS 4.33 – iPod TouchUser-Agent:Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5safari iOS 4.33 – iPadUser-Agent:Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5Android N1User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1Android QQ For androidUser-Agent: MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1Android Opera MobileUser-Agent: Opera/9.80 (Android 2.3.4; Linux; Opera Mobi/build-1107180945; U; en-GB) Presto/2.8.149 Version/11.10Android Pad Moto XoomUser-Agent: Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13BlackBerryUser-Agent: Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.337 Mobile Safari/534.1+WebOS HP TouchpadUser-Agent: Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 TouchPad/1.0Nokia N97User-Agent: Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/20.0.019; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.18124Windows Phone MangoUser-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; HTC; Titan)UC标准User-Agent: NOKIA5700/ UCWEB7.0.2.37/28/999UCOpenwaveUser-Agent: Openwave/ UCWEB7.0.2.37/28/999UC OperaUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; ) Opera/UCWEB7.0.2.37/28/999 .

 

For user OS system type, you can use User-Agent in request headers:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38

For example the above value means Windows 10 x64 edition. 

As there are many browsers and many system types and versions, it is not easy to do a holistic parsing. What you can do is to find out the most useful ones for you based on each browser User-Agent definitions. 

For client local user machine name, it is not sent to the server in the request unless you are using Windows Authentication. Even for this authentication type, it doesn't necessarily represent the actual user name as user can use Run As to impersonate users.