detecting browser version


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
Minified + gzip package size for @adwatch/browserdetect in KB



Browser detect module


$ npm install --save @adwatch/browserdetect


import BrowserDetect from '@adwatch/browserdetect';        // for es6

var BrowserDetect = require('@adwatch/browserdetect/build');    // for es5

let browserDetect = new BrowserDetect(options);

Get started

let browserDetect = new BrowserDetect(options);



Name Type Description
timeOutLocalStorageName number Variable timeout name for localStorage. Default - 0.
check array Browser verification options*.
onInit function Inited browsercheck callback.
onCheckFailed function Checked old browser callback.

* Browser verification options:

Array - [name, platform, version, device], [name, platform, version, device],...

Value Type Description
name string Browser name (msie, edge, safari, blackberry, yandex, playbook, opera, opera mini, android, kindle, silk, firefox, chrome) - required.
version string Maximum browser version - optional.
platform string Platform (ipod, ipad, iphone, kindle, silk, android, windows phone, win, mac, linux, cros, playbook, blackberry) - optional.
device string Device (desktop, mobile) - optional.
*     Default:
*    ['edge', '14', false, 'desktop'],
*    ['msie', '11', false, 'desktop'],
*    ['chrome', '49', 'win', 'desktop'],
*    ['firefox', '52'],
*    ['opera', '47'],
*    ['safari', false, 'win'],
*    ['safari', '10', 'mac']

Callbacks option arguments

onInit arguments: ({ browser data})

onCheckFailed arguments: ({ browser data })

Callbacks return data:

Key Type Description
browserName string Browser name
browserVersion number Browser version major.
browserVersionFull string Browser full version
checkFailed boolean Browser compliance with the specified options
devicePlatform string Device platform
deviceType string Device type (desktop or mobile)
timeout number Time of absence of verification (in ms)
webkit boolean Webkit - type check



Setting the time in hours for absence of verification


Return actual timeout in ms

type (default returned in milliseconds);
s - returned in seconds;
m - returned in minutes;
h - returned in hours;



If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.