mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Revise window object detection
This commit is contained in:
parent
5cc6bf78a5
commit
3ecb3fbea2
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UA-Parser.JS",
|
"title": "UA-Parser.JS",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.4.12",
|
"version": "0.4.13",
|
||||||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -73,6 +73,10 @@ Extract detailed type of web browser, layout engine, operating system, and devic
|
|||||||
|
|
||||||
## Using node.js
|
## Using node.js
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install ua-parser-js
|
||||||
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var UAParser = require('ua-parser');
|
var UAParser = require('ua-parser');
|
||||||
var parser = new UAParser();
|
var parser = new UAParser();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// UA-Parser.JS v0.4.12
|
// UA-Parser.JS v0.4.13
|
||||||
// Lightweight JavaScript-based User-Agent string parser
|
// Lightweight JavaScript-based User-Agent string parser
|
||||||
// https://github.com/faisalman/ua-parser-js
|
// https://github.com/faisalman/ua-parser-js
|
||||||
//
|
//
|
||||||
// Copyright © 2012 Faisalman
|
// Copyright © 2012 Faisalman
|
||||||
// Dual licensed under GPLv2 & MIT
|
// Dual licensed under GPLv2 & MIT
|
||||||
|
|
||||||
(function (undefined) {
|
(function (global, undefined) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -358,7 +358,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// check whether script is running inside node.js export as module
|
// check whether script is running inside node.js export as module
|
||||||
if (typeof exports !== 'undefined' && (!this || this.toString() !== '[object DOMWindow]')) {
|
if (typeof exports !== 'undefined' && !/\[object\s[DOM]*Window\]/.test(global.toString())) {
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
exports = module.exports = UAParser;
|
exports = module.exports = UAParser;
|
||||||
}
|
}
|
||||||
@ -366,4 +366,4 @@
|
|||||||
} else {
|
} else {
|
||||||
window['UAParser'] = UAParser;
|
window['UAParser'] = UAParser;
|
||||||
}
|
}
|
||||||
})();
|
})(this);
|
Loading…
x
Reference in New Issue
Block a user