Git Product home page Git Product logo

useragent.js's Introduction

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

useragent.js's People

Contributors

uupaa avatar

Watchers

James Cloos avatar yuki shibata avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.