mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Fix Chrome for iOS not detected
This commit is contained in:
parent
3ecb3fbea2
commit
d1d4e0a7a0
@ -1,7 +1,7 @@
|
||||
{
|
||||
"title": "UA-Parser.JS",
|
||||
"name": "ua-parser-js",
|
||||
"version": "0.4.13",
|
||||
"version": "0.4.14",
|
||||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
],
|
||||
"main": "ua-parser",
|
||||
"scripts": {
|
||||
"test": "./node_modules/mocha/bin/mocha"
|
||||
"test": "./node_modules/mocha/bin/mocha -R spec"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": ">= 1.7.1"
|
||||
|
14
ua-parser.js
14
ua-parser.js
@ -1,4 +1,4 @@
|
||||
// UA-Parser.JS v0.4.13
|
||||
// UA-Parser.JS v0.4.14
|
||||
// Lightweight JavaScript-based User-Agent string parser
|
||||
// https://github.com/faisalman/ua-parser-js
|
||||
//
|
||||
@ -152,7 +152,7 @@
|
||||
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
|
||||
], [['name', 'Yandex'], 'version', 'major'], [
|
||||
|
||||
/(?:android.+(crmo|crios))\/((\d+)?[\w\.]+)/i, // Chrome for Android/iOS
|
||||
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i, // Chrome for Android/iOS
|
||||
], [['name', 'Chrome'], 'version', 'major'], [
|
||||
|
||||
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
|
||||
@ -318,7 +318,7 @@
|
||||
|
||||
var UAParser = function UAParser (uastring) {
|
||||
|
||||
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : "");
|
||||
var ua = uastring || ((global && global.navigator && global.navigator.userAgent) ? global.navigator.userAgent : "");
|
||||
|
||||
this.getBrowser = function () {
|
||||
return mapper.regex.apply(this, regexes.browser);
|
||||
@ -357,13 +357,15 @@
|
||||
this.setUA(ua);
|
||||
};
|
||||
|
||||
// check whether script is running inside node.js export as module
|
||||
// check js environment
|
||||
if (typeof exports !== 'undefined' && !/\[object\s[DOM]*Window\]/.test(global.toString())) {
|
||||
// nodejs env
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
exports = module.exports = UAParser;
|
||||
}
|
||||
exports.UAParser = UAParser;
|
||||
} else {
|
||||
window['UAParser'] = UAParser;
|
||||
// browser env
|
||||
global['UAParser'] = UAParser;
|
||||
}
|
||||
})(this);
|
||||
})(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user