Low Browser
Internet Explorer and Microsoft Edge browsers definition on JavaScript
Why?
Sometimes need to define only browsers from Microsoft. Other tools on JavaScript is bloated and slower. Because they seek to support most browsers.
Features
- Pure, small (about 600 bytes gzip) and fast.
- Has no dependencies.
- Focused only on Microsoft browsers.
- Exports as UMD: Browser (global), AMD, CommonJS.
- Exports as ES Module.
- Has types for TypeScript.
Table of Contents
Install
$ yarn add low-browser
OR get it in https://unpkg.com/low-browser@0.3/dist/
Usage
Function parses given user agent string and returns data object
ES Module
Can be downloaded from https://unpkg.com/low-browser@0.3/dist/low-browser.esm.min.js
import lowBrowser from './low-browser.esm.min.js'
const {name, version} = lowBrowser('some user agent string')
if (name === 'IE' && version === '8.0') {
}
UMD
Can be downloaded from https://unpkg.com/low-browser@0.3/dist/low-browser.umd.min.js
Browser (global)
var data = lowBrowser('some user agent string')
if (data.name === 'IE' && data.version === '8.0') {
}
AMD
define('your-module', ['low-browser'], function (lowBrowser) {
var data = lowBrowser('some user agent string')
if (data.name === 'IE' && data.version === '8.0') {
}
})
CommonJS
const lowBrowser = require('low-browser')
const {name, version} = lowBrowser('some user agent string')
if (name === 'IE' && version === '8.0') {
}
Types
For TypeScript. Included in package. Can be downloaded from https://unpkg.com/low-browser@0.3/dist/low-browser.d.ts
Data object
Returns data object after parsing given user agent string
userAgent
Input user agent string
Type: string
name
Browser name
Type: string
May be Edge
, IE
, IEMobile
version
Browser version
Type: string
Example: 5.5b1
core
Browser core name
Type: string
May be EdgeHTML
or Trident
.
coreVersion
Browser core version
Type: string
Example: 4.0b1
os
Operating System
Type: string
Example: Windows NT 10.0
osBuild
Operating System Build Number
Only for Microsoft Edge browser
Type: number
Example: 16299
gamePlatform
Game Platform
Type: string
May be Xbox 360
or Xbox One
Tests
$ git clone https://github.com/Arttse/low-browser.git && cd low-browser/
$ yarn
$ yarn run test
License
MIT © 2015-2018 Nikita Bystrov (Arttse)