Skip to content
Detect the OS, Browser and WebView from UserAgent String.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github update WebModule's component Mar 3, 2016
docs update docs/index.html Sep 22, 2016
lib remove BROWSER_ENGINE property, add has(), remove set() method Apr 10, 2017
lint/plato first commit Aug 12, 2015
release first commit Aug 12, 2015
test remove BROWSER_ENGINE property, add has(), remove set() method Apr 10, 2017
.eslintignore update WebModule's component Mar 3, 2016
.eslintrc
.gitignore first commit Aug 12, 2015
.npmignore first commit Aug 12, 2015
.travis.yml update WebModule's component Mar 3, 2016
LICENSE Initial commit Aug 12, 2015
README.md remove BROWSER_ENGINE property, add has(), remove set() method Apr 10, 2017
index.js first commit Aug 12, 2015
package.json remove BROWSER_ENGINE property, add has(), remove set() method Apr 10, 2017

README.md

UserAgent.js Build Status

npm

Detect the OS, Browser and WebView from UserAgent String.

This module made of WebModule.

Documentation

Browser, NW.js and Electron

<script src="UserAgent.js/lib/WebModule.js"></script>
<script src="UserAgent.js/node_modules/uupaa.webgldetector.js/lib/WebGLDetector.js"></script>
<script src="UserAgent.js/lib/UserAgent.js"></script>
<script>

var ua = new UserAgent();

ua.OS               // -> "iOS"
ua.OS_VERSION       // -> "8.1.0"
ua.PC               // -> false
ua.MOBILE           // -> true
ua.BROWSER          // -> "Safari"
ua.BASE_BROWSER     // -> "WebKit"
ua.BROWSER_VERSION  // -> "8.0.0"
ua.USER_AGENT       // -> "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4"
ua.LANGUAGE         // -> "ja"
ua.WEB_VIEW         // -> false
ua.DEVICE           // -> "iPhone 5"
ua.TOUCH_3D         // -> false
ua.CARRIER          // -> ""
ua.FEATURE_PHONE    // -> false
ua.ES5              // -> true
ua.ES6              // -> false
ua.ES2015           // -> false
// --- OS ---
ua.iOS              // -> true
ua.Mac              // -> false
ua.macOS            // -> false
ua.Android          // -> false
ua.Windows          // -> false
// --- browser ---
ua.IE               // -> false
ua.Edge             // -> false
ua.Firefox          // -> false
ua.Chrome           // -> false
ua.Safari           // -> true
ua.Silk             // -> false
ua.AOSP             // -> false
ua.WebKit           // -> true
ua.Chromium         // -> false
// --- device ---
ua.iPod             // -> false
ua.iPad             // -> false
ua.iPhone           // -> true
ua.Kindle           // -> false
</script>

WebWorkers

importScripts("UserAgent.js/lib/WebModule.js");
importScripts("UserAgent.js/node_modules/uupaa.webgldetector.js/lib/WebGLDetector.js");
importScripts("UserAgent.js/lib/UserAgent.js");

Node.js

require("UserAgent.js/lib/WebModule.js");
require("UserAgent.js/node_modules/uupaa.webgldetector.js/lib/WebGLDetector.js");
require("UserAgent.js/lib/UserAgent.js");
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.