# browsertype.js

> An automated detection library for the current browser.

Latest version **1.0.6** (published 2019-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install browsertype.js
pnpm add browsertype.js
yarn add browsertype.js
bun add browsertype.js
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-01-09 |
| First published | 2018-04-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Maximilian Schmidt |
| Maintainers | mcstreetguy |

## Links

- npm: https://www.npmjs.com/package/browsertype.js
- Repository: https://github.com/MCStreetguy/BrowserType.js
- Homepage: https://github.com/MCStreetguy/BrowserType.js#readme
- Issues: https://github.com/MCStreetguy/BrowserType.js/issues
- npm.io page: https://npm.io/package/browsertype.js

## Recent versions

- 1.0.6 (latest) — 2019-01-09
- 1.0.5 — 2019-01-09
- 1.0.4 — 2019-01-09
- 1.0.3 — 2018-04-10
- 1.0.2 — 2018-04-10
- 1.0.1 — 2018-04-10
- 1.0.0 — 2018-04-10

## README

# BrowserType.js
**An automated detection library for the current browser.**

## Installation
Include the script somehow in your page. You can retrieve it using the following methods:

**Package manager:**     
``` bash
$ npm install browsertype.js --save

$ yarn add browsertype.js

$ bower install browsertype.js --save
```

**CDN:**     
- https://bundle.run/browsertype.js@1.0.6
- https://unpkg.com/browsertype.js@1.0.6/main.js
- https://cdn.jsdelivr.net/npm/browsertype.js@1.0.6
- https://cdn.jsdelivr.net/npm/browsertype.js@1.0.6/main.min.js
- https://cdn.jsdelivr.net/gh/mcstreetguy/browsertype.js@1.0.6/main.js
- https://cdn.jsdelivr.net/gh/mcstreetguy/browsertype.js@1.0.6/main.min.js

## Usage
### Scripts
BrowserType.js registers a plain object in `window`, containing recognition expressions. It's structure is as following:

```
BrowserType = {
  isOpera,
  isFirefox,
  isSafari,
  isIE,
  isEdge,
  isChrome,
  isBlink
}
```

You can use these values directly in conditions:

``` javascript
if(BrowserType.isIE) {
  alert('You got the worst browser around, congratulations.');
} else if(BrowserType.isChrome) {
  alert('You got an evergreen browser, nice!');
}
```

### Stylesheets
BrowserType.js also sets a class on the html element, making it really easy to also differ between browsers in stylesheets.

- `bt-opera`
- `bt-firefox`
- `bt-safari`
- `bt-explorer`
- `bt-edge`
- `bt-chrome`
- `bt-other`

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