JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 185
  • Score
    100M100P100Q65339F
  • License MIT

Detect the OS, Browser and WebView from UserAgent String.

Package Exports

  • uupaa.useragent.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (uupaa.useragent.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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");