# ua-detector

> Dectect mobile browser ventor and version

Latest version **1.0.3** (published 2020-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ua-detector
pnpm add ua-detector
yarn add ua-detector
bun add ua-detector
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-10-15 |
| First published | 2017-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | 189 |
| Maintainers | 189 |
| Keywords | useragent, browser, device, operation system, detect browser, detect os |

## Links

- npm: https://www.npmjs.com/package/ua-detector
- Repository: https://github.com/189/ua-detector
- Issues: https://github.com/189/ua-detector/issues
- npm.io page: https://npm.io/package/ua-detector

## Dependencies (2)

- [tslint](https://npm.io/package/tslint.md) ^6.0.0
- [typescript](https://npm.io/package/typescript.md) ^3.8.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-10-15
- 1.0.2 — 2020-10-15
- 1.0.1 — 2020-10-15
- 1.0.0 — 2017-03-19

## README

# ua-detector

A simple package to dectect mobile browser ventor and version(`detector.browser`), and also detect device operation system(`detector.os`).

Mostly I suggest you to detect feature instend of browser ventors or version. But sometimes, there is no other way, and not even good modern browsers provide good feature detection mechanisms.

[live demo](https://codesandbox.io/s/ua-detector-demo-kxlw0)

## Usage

It works like :

```
import detector, {isMac, isWin, isIphone, isAndroid...} from "ua-detector";

console.log(detector) // output: {"os":{"win":true,"result":"win"},"browser":{"chrome":true,"result":"chrome","version":"81.0.4044.138"}}

if(detector.os.android  && detector.os.version < 4){
	// do your stuff
}

if(detector.browser.chrome  && detector.browser.version > 10 ){
	// do your stuff
}


```

## Install

```
$ npm install ua-detector -D
// or
$ yarn add ua-detector

```

## API

#### detector.browser

```
import detector from "ua-detector";
console.log(detector.browser);
// output: { result : 'chrome', version:'56.0.29', chrome : true }

```

#### detector.os

```
import detector from "ua-detector";
console.log(detector.os);
// output : { result : 'iphone', version : '9.1', iphone : true }

```

#### And More

- isMac;

```
import {isMac} from "ua-detector";
console.log(isMac); // output true or false
```

- isWin

- isIphone

- isAndroid

- isIpad

- isIpod

- isWebos

- isWinPhone

- isKindle

- isBlackberry

- isBb10

- isPlaybook

- isChrome

- isFirefoxos

- isFirefox

- isSafari

- isGreatIE
  > same as isIE
- isWebview

---
_Source: https://npm.io/package/ua-detector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
