Comparing version 2.2.2 to 2.2.3
@@ -1,172 +0,185 @@ | ||
# 演示文档 | ||
# Example | ||
--- | ||
您正在使用: | ||
You're using: | ||
<pre id="detector"></pre> | ||
<pre id="detector-info"></pre> | ||
* 如果上面识别的信息不正确,<a id="issues" | ||
* If detected information incorrect, <a id="issues" | ||
href="https://github.com/hotoo/detector/issues/new" | ||
target="_blank"><strong>请给我们提 Issues 反馈</strong></a>。 | ||
* 如果没有 Github 账户,请向我们 <a id="email" href="mailto:hotoo.cn@gmail.com" | ||
target="_blank"><strong>发送 Email</strong></a>。 | ||
* 如果点击链接无法发送 Email,请拷贝这个页面的内容手工发送 Email 给 `hotoo.cn@gmail.com`。 | ||
target="_blank"><strong>Please put new issue for feedback</strong></a>. | ||
* If you without Github account, <a id="email" href="mailto:hotoo.cn@gmail.com" | ||
target="_blank"><strong>Please send Email to us</strong></a>. | ||
* if click Email link can'nt send Email, Please copy this page's information, | ||
and send email to `hotoo.cn@gmail.com`. | ||
Thank you! | ||
<pre id="ua"></pre> | ||
<script type="text/javascript">/*<![CDATA[*/ | ||
function isObject(obj){ | ||
return Object.prototype.toString.call(obj) === "[object Object]"; | ||
} | ||
function expandObject(obj){ | ||
if(!isObject(obj)){return obj;} | ||
var s = '{'; | ||
for(var k in obj){ | ||
if(obj.hasOwnProperty(k)){ | ||
s += k + ':' + typeof obj[k] + ','; | ||
} | ||
<div style="display:none;"> | ||
````javascript | ||
require('jquery'); | ||
require('detector'); | ||
```` | ||
</div> | ||
<script> | ||
function isObject(obj){ | ||
return Object.prototype.toString.call(obj) === "[object Object]"; | ||
} | ||
function expandObject(obj){ | ||
if(!isObject(obj)){return obj;} | ||
var s = '{'; | ||
for(var k in obj){ | ||
if(obj.hasOwnProperty(k)){ | ||
s += k + ':' + typeof obj[k] + ','; | ||
} | ||
s += '}'; | ||
return s; | ||
} | ||
s += '}'; | ||
return s; | ||
} | ||
seajs.use(["jquery", "../detector"], function($, detector){ | ||
var $ = window['jquery']; // require('jquery'); | ||
var detector = window['detector']; // require('detector'); | ||
var OS_ALIAS = { | ||
// Windows. | ||
"windows/4.0": "Windows 95", | ||
"windows/4.1": "Windows 98", | ||
"windows/4.9": "Windows ME", | ||
"windows/5.0": "Windows 2000", | ||
"windows/5.1": "Windows XP", | ||
"windows/5.2": "Windows Server 2003", | ||
"windows/6.0": "Windows Vista", | ||
"windows/6.1": "Windows 7", | ||
"windows/6.2": "Windows 8", | ||
"windows/6.3": "Windows 8.1", | ||
// Mac OS X. | ||
"macosx/10.0": "Mac OS X Cheetah", | ||
"macosx/10.1": "Mac OS X Puma", | ||
"macosx/10.2": "Mac OS X Jaguar", | ||
"macosx/10.3": "Mac OS X Panther", | ||
"macosx/10.4": "Mac OS X Tiger", | ||
"macosx/10.5": "Mac OS X Leopard", | ||
"macosx/10.6": "Mac OS X Snow Leopard", | ||
"macosx/10.7": "Mac OS X Lion", | ||
"macosx/10.8": "Mac OS X Mountain Lion", | ||
"macosx/10.9": "Mac OS X Mavericks", | ||
"macosx/10.10": "Mac OS X Yosemite", | ||
// Android. | ||
"android/1.5": "Android Cupcake", | ||
"android/1.6": "Android Doughnut", | ||
"android/2.0": "Android Eclair", | ||
"android/2.1": "Android Eclair", | ||
"android/2.2": "Android Froyo", | ||
"android/2.3": "Android Gingerbread", | ||
"android/3.0": "Android Honeycomb", | ||
"android/3.1": "Android Honeycomb", | ||
"android/3.2": "Android Honeycomb", | ||
"android/4.0": "Android Ice Cream Sandwich", | ||
"android/4.1": "Android JellyBean", | ||
"android/4.2": "Android JellyBean", | ||
"android/4.3": "Android JellyBean", | ||
"android/4.4": "Android KitKat" | ||
}; | ||
var OS_ALIAS = { | ||
// Windows. | ||
"windows/4.0": "Windows 95", | ||
"windows/4.1": "Windows 98", | ||
"windows/4.9": "Windows ME", | ||
"windows/5.0": "Windows 2000", | ||
"windows/5.1": "Windows XP", | ||
"windows/5.2": "Windows Server 2003", | ||
"windows/6.0": "Windows Vista", | ||
"windows/6.1": "Windows 7", | ||
"windows/6.2": "Windows 8", | ||
"windows/6.3": "Windows 8.1", | ||
// Mac OS X. | ||
"macosx/10.0": "Mac OS X Cheetah", | ||
"macosx/10.1": "Mac OS X Puma", | ||
"macosx/10.2": "Mac OS X Jaguar", | ||
"macosx/10.3": "Mac OS X Panther", | ||
"macosx/10.4": "Mac OS X Tiger", | ||
"macosx/10.5": "Mac OS X Leopard", | ||
"macosx/10.6": "Mac OS X Snow Leopard", | ||
"macosx/10.7": "Mac OS X Lion", | ||
"macosx/10.8": "Mac OS X Mountain Lion", | ||
"macosx/10.9": "Mac OS X Mavericks", | ||
"macosx/10.10": "Mac OS X Yosemite", | ||
"macosx/10.11": "Mac OS X El Capitan", | ||
// iOS. | ||
"ios/9.0": "iOS 9.0 (Monarch)", | ||
// Android. | ||
"android/1.5": "Android Cupcake", | ||
"android/1.6": "Android Doughnut", | ||
"android/2.0": "Android Eclair", | ||
"android/2.1": "Android Eclair", | ||
"android/2.2": "Android Froyo", | ||
"android/2.3": "Android Gingerbread", | ||
"android/3.0": "Android Honeycomb", | ||
"android/3.1": "Android Honeycomb", | ||
"android/3.2": "Android Honeycomb", | ||
"android/4.0": "Android Ice Cream Sandwich", | ||
"android/4.1": "Android JellyBean", | ||
"android/4.2": "Android JellyBean", | ||
"android/4.3": "Android JellyBean", | ||
"android/4.4": "Android KitKat" | ||
}; | ||
var detectedInfo = []; | ||
detectedInfo.push("* 硬件设备:"+detector.device.name+" "+detector.device.fullVersion); | ||
var osAlias = OS_ALIAS[detector.os.name+"/"+(detector.os.fullVersion.split(".").slice(0,2).join("."))] || "N/A"; | ||
detectedInfo.push("* 操作系统:"+detector.os.name+" "+detector.os.fullVersion + " ("+osAlias+")"); | ||
detectedInfo.push("* 浏览器:"+detector.browser.name+" "+detector.browser.fullVersion+ | ||
(detector.browser.compatible ? "(" + String(detector.browser.fullMode) + " 兼容模式)" : "")); | ||
detectedInfo.push("* 渲染引擎:" + detector.engine.name + " " + detector.engine.fullVersion + | ||
(detector.engine.compatible ? "(" + String(detector.engine.fullMode) + " 兼容模式)" : "")); | ||
var detectedInfo = []; | ||
detectedInfo.push("* Hardware Device: "+detector.device.name+" "+detector.device.fullVersion); | ||
var osAlias = OS_ALIAS[detector.os.name+"/"+(detector.os.fullVersion.split(".").slice(0,2).join("."))] || "N/A"; | ||
detectedInfo.push("* Operation System: "+detector.os.name+" "+detector.os.fullVersion + " ("+osAlias+")"); | ||
detectedInfo.push("* Browser:"+detector.browser.name+" "+detector.browser.fullVersion+ | ||
(detector.browser.compatible ? "(" + String(detector.browser.fullMode) + " compatible)" : "")); | ||
detectedInfo.push("* Rendering Engine: " + detector.engine.name + " " + detector.engine.fullVersion + | ||
(detector.engine.compatible ? "(" + String(detector.engine.fullMode) + " compatible)" : "")); | ||
document.getElementById("detector").innerHTML = detectedInfo.join("<br />"); | ||
document.getElementById("detector-info").innerHTML = detectedInfo.join("<br />"); | ||
var ext; | ||
if(!window.external){ | ||
ext = "undefined"; | ||
}if(Object.prototype.toString.call(window.external)==="[object Object]"){ | ||
ext = []; | ||
try{ | ||
for(var k in window.external){ | ||
ext.push(k+": "+typeof(window.external[k])+ | ||
(window.external.hasOwnProperty(k)?"":"[prototype]")); | ||
} | ||
}catch(ex){window.console && console.log("1. "+k+":"+ex.message);} | ||
ext = "{"+ext.join(", ")+"}"; | ||
}else{ | ||
ext = window.external +"["+typeof(window.external)+"]"; | ||
var ext; | ||
if(!window.external){ | ||
ext = "undefined"; | ||
}if(Object.prototype.toString.call(window.external)==="[object Object]"){ | ||
ext = []; | ||
try{ | ||
for(var k in window.external){ | ||
ext.push(k+": "+typeof(window.external[k])+ | ||
(window.external.hasOwnProperty(k)?"":"[prototype]")); | ||
} | ||
var info = { | ||
ua : navigator.userAgent, | ||
vendor : navigator.vendor, | ||
vendorSub : navigator.vendorSub, | ||
platform : navigator.platform, | ||
external : ext, | ||
appCodeName : navigator.appCodeName, | ||
appName : navigator.appName, | ||
appVersion : navigator.appVersion, | ||
product : navigator.product, | ||
productSub : navigator.productSub, | ||
screenWidth : screen.width, | ||
screenHeight : screen.height, | ||
colorDepth : screen.colorDepth, | ||
documentMode: document.documentMode, | ||
compatMode: document.compatMode | ||
}; | ||
}catch(ex){window.console && console.log("1. "+k+":"+ex.message);} | ||
ext = "{"+ext.join(", ")+"}"; | ||
}else{ | ||
ext = window.external +"["+typeof(window.external)+"]"; | ||
} | ||
var info = { | ||
ua : navigator.userAgent, | ||
vendor : navigator.vendor, | ||
vendorSub : navigator.vendorSub, | ||
platform : navigator.platform, | ||
external : ext, | ||
appCodeName : navigator.appCodeName, | ||
appName : navigator.appName, | ||
appVersion : navigator.appVersion, | ||
product : navigator.product, | ||
productSub : navigator.productSub, | ||
screenWidth : screen.width, | ||
screenHeight : screen.height, | ||
colorDepth : screen.colorDepth, | ||
documentMode: document.documentMode, | ||
compatMode: document.compatMode | ||
}; | ||
var a = [ | ||
"| 字段 | 值 |", | ||
"|------|----|" | ||
]; | ||
for(var k in info){ | ||
if(!info.hasOwnProperty(k)){continue;} | ||
try{ // IE10 不支持此属性或方法。。。 | ||
a.push("| "+k+" | "+String(info[k])+" |"); | ||
}catch(ex){window.console && console.log("2. "+k+":"+ex.message);} | ||
} | ||
var a = [ | ||
"| Field | Value |", | ||
"|------|----|" | ||
]; | ||
for(var k in info){ | ||
if(!info.hasOwnProperty(k)){continue;} | ||
try{ // IE10 不支持此属性或方法。 | ||
a.push("| "+k+" | "+String(info[k])+" |"); | ||
}catch(ex){window.console && console.log("2. "+k+":"+ex.message);} | ||
} | ||
var detector_version = $("p.sidebar-version > a").text(); | ||
var detector_version = $("p.sidebar-version > a").text(); | ||
document.getElementById("ua").innerHTML = | ||
"detector 版本:" + detector_version + "<br /><br/>" + | ||
a.join("<br />"); | ||
document.getElementById("ua").innerHTML = | ||
"detector version: " + detector_version + "<br /><br/>" + | ||
a.join("<br />"); | ||
document.getElementById("email").setAttribute("href", | ||
"mailto:hotoo.cn@gmail.com?subject=" + | ||
encodeURIComponent("Detector 识别信息") + | ||
"&body="+ | ||
document.getElementById("email").setAttribute("href", | ||
"mailto:hotoo.cn@gmail.com?subject=" + | ||
encodeURIComponent("detector: detected information") + | ||
"&body="+ | ||
encodeURIComponent( | ||
"Help us for fix incorrect detected information: \n\n"+ | ||
"> Note: You just need to fix the part of incorrect information.\n\n"+ | ||
detectedInfo.join("\n")+ | ||
"\n\n=========================\n"+ | ||
"REFERENCE INFORMATION BY AUTO DETECTED (DO'NT MODIFY):\n\n" + | ||
"detector version: " + detector_version + "\n\n" + | ||
a.join("\n") | ||
)); | ||
document.getElementById("issues").href = "https://github.com/hotoo/detector/issues/new" + | ||
"?title=detector%20 detected information"+ | ||
"&body=" + | ||
encodeURIComponent( | ||
"请修正我们识别错误的信息:\n\n"+ | ||
"> 注:只需要修改识别错误的部分即可。\n\n"+ | ||
"Help us for fix incorrect detected information:\n\n"+ | ||
"> Note: You just need to fix the part of incorrect information.\n\n"+ | ||
detectedInfo.join("\n") + | ||
"\n"+ | ||
"\n=========================\n"+ | ||
"REFERENCE INFORMATION BY AUTO DETECTED (DO'NT MODIFY):\N\N"+ | ||
"detector version: " + detector_version + "\n\n" + | ||
detectedInfo.join("\n")+ | ||
"\n\n=========================\n"+ | ||
"自动识别的原始信息如下(请勿修改):\n\n" + | ||
"detector 版本:" + detector_version + "\n\n" + | ||
"\n\n"+ | ||
a.join("\n") | ||
)); | ||
); | ||
</script> | ||
document.getElementById("issues").href = "https://github.com/hotoo/detector/issues/new" + | ||
"?title=detector%20识别信息"+ | ||
"&body=" + | ||
encodeURIComponent( | ||
"请修正我们识别错误的信息:\n\n"+ | ||
"> 注:只需要修改识别错误的部分即可。\n\n"+ | ||
detectedInfo.join("\n") + | ||
"\n"+ | ||
"\n=========================\n"+ | ||
"自动识别的原始信息如下(请勿修改):\n\n"+ | ||
"detector 版本:" + detector_version + "\n\n" + | ||
detectedInfo.join("\n")+ | ||
"\n\n"+ | ||
a.join("\n") | ||
); | ||
}); | ||
/*]]>*/</script> | ||
Scan QR code for vist this page. | ||
扫描下面的二维码直接访问当前页面。 | ||
![二维码](code.png) | ||
![QR code](code.png) |
# 测试工具 | ||
# Detector Parser | ||
@@ -10,9 +10,10 @@ ---- | ||
## 输入 | ||
## INPUT | ||
请将 userAgent 字符串粘贴到下面的输入框中,每行一个 userAgent 字符串。 | ||
Put userAgent strings into following input textarea: | ||
(per-line an userAgent string.) | ||
<textarea id="userAgents" style="width:99%;height:200px"></textarea> | ||
<button type="button" id="btn-analytics" style="margin:10px 0; width:100%;">分析</button> | ||
<button type="button" id="btn-analytics" style="margin:10px 0; width:100%;">Parse</button> | ||
@@ -22,3 +23,3 @@ | ||
## 结果 | ||
## OUTPUT | ||
@@ -37,4 +38,10 @@ Markdown: | ||
````javascript | ||
var $ = require('jquery'); | ||
var detector = require('detector'); | ||
``` | ||
<script> | ||
seajs.use(['jquery', '../detector'], function($, detector){ | ||
var $ = window['jquery']; // require('jquery'); | ||
var detector = window['detector']; // require('detector'); | ||
var ua = navigator.userAgent; | ||
@@ -112,4 +119,2 @@ var ipt = $("#userAgents"); | ||
} | ||
}); | ||
</script> |
{ | ||
"name": "detector", | ||
"version": "2.2.2", | ||
"description": "客户端信息识别模块", | ||
"version": "2.2.3", | ||
"description": "The module for detect client-side information.", | ||
"homepage": "http://spmjs.io/docs/detector/", | ||
@@ -17,3 +17,3 @@ "author": "冒顿 <hotoo.cn@gmail.com>", | ||
}, | ||
"keywords": ["utility", "userAgent", "arale"], | ||
"keywords": ["utility", "userAgent", "arale", "Browser", "OS", "Operation System", "Device", "Rendering Engine"], | ||
"repository": { | ||
@@ -44,3 +44,7 @@ "type": "git", | ||
"grunt-contrib-watch": "0.6.0" | ||
}, | ||
"browser": { | ||
"commander": false, | ||
"colors": false | ||
} | ||
} |
206
README.md
@@ -11,12 +11,11 @@ # detector | ||
Client information detector, for auto detect user agent, include: | ||
客户端信息识别模块,用于自动识别用户使用的客户端环境。包括: | ||
1. Device. | ||
2. Operation System (OS). | ||
3. Browser. | ||
4. Rendering Engine. | ||
1. 硬件设备。 | ||
2. 操作系统。 | ||
3. 浏览器。 | ||
4. 浏览器渲染引擎。 | ||
Detected information data structure like: | ||
识别到的信息结构如下: | ||
```javascript | ||
@@ -57,17 +56,19 @@ detector = { | ||
备注:上面的 `[iphone]`, `[ios]`, `[chrome]`, `[webkit]` 是动态的,根据实际识别 | ||
到的信息不同而有所不同。 | ||
**Note**: Above `[iphone]`, `[ios]`, `[chrome]`, `[webkit]` is dynamically from | ||
actual environment, different device, operation system, browser and rendering | ||
engine is different. | ||
注: | ||
Note: | ||
* 这个版本遵循 CommonJS 规范,同时兼容基于 Node 环境和 Web 浏览器环境运行。 | ||
* 有些场景只需要简单识别特定的信息,可以参考 | ||
[识别特定浏览器最佳实践](https://github.com/hotoo/detector/issues/18) | ||
而无需使用 detector。 | ||
* This version of detector's code is follow CommonJS sepcification, and support | ||
NodeJS and Web Browser environment at the same time. | ||
* Some times, you just need simple detect a litter information, please reference | ||
to [#18](https://github.com/hotoo/detector/issues/18), without `detector`. | ||
## 安装 | ||
## Installation | ||
via npm: | ||
全局安装(`-g`)时,可以在终端使用 `detector` 命令。 | ||
Installation to global (with `-g` argument), you can use `detector` command in | ||
terminal. | ||
@@ -79,3 +80,3 @@ ``` | ||
via spm@3.x: | ||
via spm: | ||
@@ -87,19 +88,19 @@ ``` | ||
## 使用说明 | ||
## Usage | ||
一般情况下,常见使用范例: | ||
Some examples in common use: | ||
```javascript | ||
// 判断浏览器名 | ||
// Detect browser name. | ||
detector.browser.name === "chrome" // true | ||
// 判断浏览器名方法 2. | ||
// An other example for detect browser name. | ||
!!detector.browser.ie // false | ||
// 判断老旧浏览器 | ||
// Detect the old browseres. | ||
if(detector.browser.ie && detector.browser.version < 8){ | ||
alert("你的浏览器太老了。"); | ||
alert("You browser is too old."); | ||
} | ||
// 判断 Trident 4(IE8) 以下版本浏览器引擎 | ||
// Detect rendering engine below Trident 4 (IE8). | ||
if(detector.engine.trident && detector.engine.mode < 4){ | ||
@@ -109,3 +110,3 @@ // hack code. | ||
// 收集客户端详细信息 | ||
// Collect client detail informations. | ||
detector.browser.name + "/" + detector.browser.fullVersion; | ||
@@ -119,17 +120,17 @@ ``` | ||
设备名称。 | ||
Name of hardware device. | ||
### {Number} detector.device.version | ||
设备版本号。 | ||
Version of hardware device. | ||
### {String} detector.device.fullVersion | ||
设备完整版本号。 | ||
Full version of hardware device. | ||
### {Number} detector.device[device_name] | ||
直接判断设备名。 | ||
Detect name of hardware device. | ||
可以识别的设备名称为: | ||
Support hardware devices: | ||
@@ -142,26 +143,28 @@ * `pc`: Windows PC. | ||
* `android`: Android. | ||
* `blackberry`: 黑莓(Blackberry)手机。 | ||
* `blackberry`: Blackberry mobile. | ||
* `wp`: Windows Phone. | ||
* `mi`: 小米。 | ||
* `meizu`: 魅族。 | ||
* `mi`: Xiaomi. | ||
* `meizu`: meizu. | ||
* `nexus`: Nexus. | ||
* `nokia`: Nokia. | ||
* `samsung`: 三星手机。 | ||
* `aliyun`: 阿里云手机。 | ||
* `huawei`: 华为手机。 | ||
* `lenovo`: 联想手机。 | ||
* `zte`: 中兴手机。 | ||
* `vivo`: 步步高手机。 | ||
* `htc`: HTC。 | ||
* `oppo`: OPPO 手机。 | ||
* `konka`: 康佳手机。 | ||
* `sonyericsson`: 索尼爱立信手机。 | ||
* `coolpad`: 酷派手机。 | ||
* `lg`: LG 手机。 | ||
* `samsung`: samsung. | ||
* `aliyun`: Aliyun. | ||
* `huawei`: Huawei (华为) | ||
* `lenovo`: lenovo. | ||
* `zte`: ZTE Corporation (中兴) | ||
* `vivo`: vivo (步步高) | ||
* `htc`: HTC. | ||
* `oppo`: OPPO. | ||
* `konka`: konka (康佳) | ||
* `sonyericsson`: sonyericsson (索尼爱立信) | ||
* `coolpad`: coolpad (酷派) | ||
* `lg`: LG. | ||
##### NODE ONLY | ||
Following hardware device support in NodeJS version of `detector`: | ||
* `noain`: [诺亚信](http://www.noain.com.cn/) | ||
* `huawei-honor`: [华为荣耀](http://www.honor.cn/) | ||
* `lephone`: [乐Phone](http://www.lephonemall.com/) | ||
* `lephone`: [乐 Phone](http://www.lephonemall.com/) | ||
* `asus`: [华硕](https://www.asus.com.cn/Phones/) | ||
@@ -171,3 +174,3 @@ * `alcatel` | ||
* `蓝米` | ||
* `E派` | ||
* `E 派` | ||
* `hike` | ||
@@ -228,17 +231,17 @@ * `qmi` | ||
操作系统名。 | ||
Name of operation system. | ||
### {Number} detector.os.version | ||
操作系统版本号。 | ||
Version of operation system. | ||
### {String} detector.os.fullVersion | ||
操作系统完整版本号。 | ||
Full version of operation system. | ||
### {Number} detector.os[os_name] | ||
直接判断操作系统。 | ||
Detect name of operation system. | ||
可以识别的操作系统包括: | ||
Support operation system list: | ||
@@ -252,11 +255,13 @@ * `windows`: Windows. | ||
* `wp`: Windows Phone. | ||
* `windowsce`: Windows CE, 包括 Windows Mobile, Smartphone, PPC. | ||
* `windowsce`: Windows CE, include Windows Mobile, Smartphone, PPC. | ||
* `symbian`: Symbian OS. | ||
* `blackberry`: Blackberry 操作系统。 | ||
* `yunos`: 阿里云系统。 | ||
* `blackberry`: Blackberry OS. | ||
* `yunos`: Aliyun OS. | ||
##### NODE ONLY | ||
Following operation system support in NodeJS version of `detector`: | ||
* `meego`: Meego. | ||
* `smartisan`: 锤子, Smartisan. | ||
* `smartisan`: Smartisan. | ||
@@ -268,32 +273,34 @@ | ||
浏览器名。 | ||
Name of browser. | ||
### {Number} detector.browser.version | ||
浏览器真实版本。兼容模式下浏览器声明自己是某老旧浏览器,但这个属性返回的是 | ||
其真正的版本号。 | ||
Real version of browser. | ||
适用于收集统计分析客户端信息。 | ||
In compatibility-mode, Internet Explorer declare it is a old browser. | ||
but `detector.browser.version` return the real version of browser. | ||
例如: | ||
For example: | ||
IE9 兼容模式声明自己是 IE7,但是 `detector.browser.version` 返回 `9.0` | ||
IE9 declare it is a IE7 in compatibility-mode, but `detector.browser.version` | ||
return `9.0`. | ||
### {String} detector.browser.fullVersion | ||
浏览器完整的真实版本号。 | ||
Full (real) version of browser. | ||
### {Number} detector.browser.mode | ||
浏览器模式。即浏览器当时使用的模式,IE 兼容模式时,version 和 mode 值不同。 | ||
Browser-mode. In Internet Explorer's compatibility-mode, version and mode | ||
is different. | ||
### {String} detector.browser.fullMode | ||
浏览器模式的完整版本号。 | ||
Full mode of browser. | ||
### {Number} detector.browser[browser_name] | ||
直接判断浏览器。 | ||
Detect name of browser. | ||
可以识别的浏览器为: | ||
Support browser list: | ||
@@ -305,21 +312,21 @@ * `ie`: Microsoft Internet Explorer. | ||
* `opera`: Opera. | ||
* `360`: 包括奇虎 360 安全浏览器和 360 极速浏览器。 | ||
* `maxthon`: 傲游浏览器(Maxthon)。 | ||
* `sogou`: 搜狗浏览器(Sogou)。 | ||
* `theworld`: 世界之窗浏览器(TheWorld)。 | ||
* `360`: Qihu 360 browser. | ||
* `maxthon`: Maxthon. | ||
* `sogou`: Sogou. | ||
* `theworld`: TheWorld. | ||
* `green`: GreenBrowser. | ||
* `qq`: QQ 浏览器。 | ||
* `qq`: QQ Browser. | ||
* `tt`: TencentTraveler. | ||
* `liebao`: 猎豹浏览器。 | ||
* `tao`: 淘宝浏览器。 | ||
* `coolnovo`: 枫树浏览器。 | ||
* `saayaa`: 闪游浏览器。 | ||
* `uc`: UC 浏览器。 | ||
* `mi`: 小米浏览器。 | ||
* `baidu`: 百度浏览器。 | ||
* `nokia`: 诺基亚浏览器。 | ||
* `liebao`: Cheetah Mobile Inc. (猎豹) Browser. | ||
* `tao`: Taobao (淘宝) Browser. | ||
* `coolnovo`: coolnovo (枫树) | ||
* `saayaa`: Saayaa (闪游) | ||
* `uc`: UC Browser. | ||
* `mi`: Build-in browser in Xiaomi (小米). | ||
* `baidu`: Baidu (百度) browser. | ||
* `nokia`: Build-in Browser in Nokia (诺基亚) | ||
* `blackberry`: 黑莓默认浏览器,版本号与系统版本相同。 | ||
* `webview`: iOS 系统的提供的 WebView。 | ||
* `webview`: iOS WebView. | ||
* `yandex`: Yandex YaBrowser. | ||
* `ali-ap`: 支付宝手机客户端。 | ||
* `ali-ap`: 支付宝手机钱包。 | ||
* `ali-ap-pd`: 支付宝平板客户端。 | ||
@@ -334,3 +341,3 @@ * `ali-am`: 支付宝商户客户端。 | ||
* `googlebot`: [Googlebot](wiki/googlebot.md) 网络爬虫。 | ||
* `googlebot`: [Googlebot](wiki/googlebot.md) | ||
* `baiduspider`: [Baiduspider](wiki/baiduspider.md) ,百度无线、网页搜索 | ||
@@ -349,3 +356,3 @@ * `baiduspider-image`: 百度图片搜索 | ||
* `curl`: curl. | ||
* `micromessenger` 微信 | ||
* `micromessenger` WeChat (微信) | ||
* ~~`slurpbot`: Yahoo! [Slurp](wiki/slurpbot.md)~~ | ||
@@ -356,3 +363,3 @@ | ||
浏览器是否处于兼容模式。 | ||
Judge is browser in compatibility-mode. | ||
@@ -364,19 +371,19 @@ | ||
渲染引擎名(又称排版引擎、浏览器内核)。 | ||
Name of rendering engine. | ||
### {Number} detector.engine.version | ||
渲染引擎版本号。 | ||
Version of rendering engine. | ||
### {String} detector.engine.fullVersion | ||
渲染引擎完整版本号。 | ||
Full version of rendering engine. | ||
### {Number} detector.engine.mode | ||
渲染引擎模式,即 IE 浏览器的文档模式。 | ||
Mode of rendering engine. | ||
### {String} detector.engine.fullMode | ||
渲染引擎模式完整版本号。 | ||
Full-mode of rendering engine. | ||
@@ -386,5 +393,5 @@ | ||
直接判断渲染引擎。 | ||
Detect name of rendering engine. | ||
可以识别的渲染引擎为: | ||
Support rendering engine list: | ||
@@ -398,18 +405,15 @@ * `trident`: Microsoft Trident. | ||
* `coolpadwebkit`: Coolpad Webkit. | ||
* `u2`: UC 浏览器渲染引擎 v2 | ||
* `u3`: UC 浏览器渲染引擎 v3 | ||
* `u2`: UC browser rendering engine `v2`. | ||
* `u3`: UC browser rendering engine `v3`. | ||
### {detector} detector.parse(String ua) | ||
根据 userAgent 字符串识别客户端信息的接口。 | ||
Parse user agent string, return a `detector` object. | ||
服务端程序可以使用这个接口识别客户端信息,由于服务端程序的特殊性,可以补充 | ||
更完善的检测规则。 | ||
---- | ||
对于不能识别的信息,统一如下: | ||
Not Available information: | ||
* 所有不能识别的名称均归类为 `na`,即 Not Available. | ||
* 所有不能识别的版本号归类为 `-1`。 | ||
* Not Available name will be `na`. | ||
* Not Available version will be `-1`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118115
16
402