浏览器User-agent的解析过程如下:
为什么要有Mozilla,请看上一篇文章,只有,Opera才光明正大,写着自己的名字,
user-agent一般包括三个内容:
系统版本,
浏览器内核,
浏览器版本,
总结如下:
IE用的trident内核;
Firefox用的Gecko内核;
Safari用的自己的WebKit内核,(防Gecko)
Chrome也用的Webkit内核,(防safari,即防Gecko)
IE
而IE各个版本典型的userAgent如下:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)
其中,版本号是MSIE之后的数字。
Firefox
Firefox几个版本的userAgent大致如下:
Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1
Mozilla/5.0 (Windows; U; Windows NT 5.1) Gecko/20070309 Firefox/2.0.0.3
Mozilla/5.0 (Windows; U; Windows NT 5.1) Gecko/20070803 Firefox/1.5.0.12 其中,版本号是Firefox之后的数字。
Opera
Opera典型的userAgent如下:
Opera/9.27 (Windows NT 5.2; U; zh-cn)
Opera/8.0 (Macintosh; PPC Mac OS X; U; en)
Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.0
其中,版本号是靠近Opera的数字。
Safari
Safari典型的userAgent如下:
Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13
Mozilla/5.0 (iPhone; U; CPU like Mac OS X) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3
其版本号是Version之后的数字。
Chrome
目前,Chrome的userAgent是:
Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleW
ebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
其中,版本号在Chrome之后的数字。
附加一个Windows NT版本:、
NT 版本 | 市场名称 | 版本 | 发布日期 | RTM Build |
---|---|---|---|---|
NT 3.1 | Windows NT 3.1 | Workstation(仅被命名为“Windows NT”), Advanced Server | 1993年7月27日 | 528 |
NT 3.5 | Windows NT 3.5 | Workstation, Advanced Server | 1994年9月5日 | 807 |
NT 3.51 | Windows NT 3.51 | Workstation, Server | 1995年5月30日 | 1057 |
NT 4.0 | Windows NT 4.0 | Workstation, Server, Server Enterprise Edition, Terminal Server, Embedded | 1996年7月29日 | 1381 |
NT 5.0 | Windows 2000 | Professional, Server, Advanced Server, DataCenter Server | 2000年2月17日 | 2195 |
NT 5.1 | Windows XP | Home, Professional, Media Center, Tablet PC, Starter, Embedded, N | 2001年10月15日 | 2600 |
NT 5.2 | Windows XP | 64-bit Edition Version 2003 (此专为IA64而开发), Professional x64 Edition |
| 3790 |
Windows Server 2003 | Standard, Enterprise, DataCenter, Web, Small Business Server | 2003年4月24日 | ||
Windows Server 2003 R2 | Standard, Enterprise, DataCenter, Web, Small Business Server | 2005年12月6日 | ||
NT 6.0 | Windows Vista | Starter, Home Basic, Home Premium, Professional, Enterprise, Ultimate | 2007年1月30日 |
|
Windows Server 2008 | Foundation, Standard, Enterprise, Datacenter, Web Server, HPC Server, Itanium-Based Systems | 2008年8月27日 |
| |
NT 6.1 | Windows 7 | Starter, Home Basic, Home Premium, Professional, Enterprise, Ultimate | 2009年10月22日 |
|
Windows Server 2008 R2 | Foundation, Standard, Enterprise, Datacenter, Web Server, HPC Server, Itanium-Based Systems | 2009年10月22日 |
| |
NT 6.2 | Windows 8 | Windows 8, Windows 8 Pro, Windows 8 Enterprise, Windows RT | 2012年10月26日 | 9200 |
Windows Phone 8 | 不适用 | 2012年10月30日 | 9900 | |
Windows Server 2012 | Foundation, Essentials, Standard, Datacenter | 2012年9月4日 | 9200 | |
NT 6.3 | Windows 8.1 | Windows 8.1, Windows 8.1 Pro, Windows 8.1 Enterprise, Windows RT 8.1 | 2013年10月18日 | 9600 |
Windows Server 2012 R2 | Essentials, Standard, Datacenter | 2013年10月18日 | 9600 |
再介绍一个小技巧:
探测64位版本IE
携带4GB内存的机器越来越多,运行64位版本Windows的用户也越来越多,为了解决第三方插件的兼容性问题,32位版本的IE仍然是64位Windows里的默认版本。在某些情况下,它对网站识别用户使用64位系统的访问具有很大的作用,比如,某个网站可能需要自动识别是否需要为用户提供64位程序下载。
UA字符串里的标记可以让你知道用户是否使用Windows 64位系统,以及他们是否运行着64位IE:
WOW64代表“Windows on Windows 64-bit.”
携带4GB内存的机器越来越多,运行64位版本Windows的用户也越来越多,为了解决第三方插件的兼容性问题,32位版本的IE仍然是64位Windows里的默认版本。在某些情况下,它对网站识别用户使用64位系统的访问具有很大的作用,比如,某个网站可能需要自动识别是否需要为用户提供64位程序下载。
UA字符串里的标记可以让你知道用户是否使用Windows 64位系统,以及他们是否运行着64位IE:
WOW64代表“Windows on Windows 64-bit.”