Author: | yankouskia |
---|---|
Views Total: | 422 views |
Official Page: | Go to website |
Last Update: | May 30, 2019 |
License: | MIT |
Preview:

Description:
get-browser is a pure JavaScript library that tells you what device and web/mobile browser you’re using.
Supports Desktop, Mobile, Android, iOS, Chrome, Firefox, Safari, Opera, IE, Edge, etc.
See also:
- Detect Browser Information With Pure JavaScript – detect-browser.js
- Minimal Browser Feature Detection In Pure JavaScript – BrowserFeatures.js
- JavaScript Library For Browser/OS/Device Detection – Detect.js
- Detect browser, Device and OS With jQuery – js.device.detector
How to use it:
Install and import modules.
# Yarn $ yarn add get-browser # NPM $ npm install get-browser --save
import { browsers, detect, isMobile, isAndroid, isChrome, isEdge, isFirefox, isIE, isOpera, isSafari, } from 'get-browser';
Or directly import the umd version in the document.
<script src="./dist/index.js"></script>
Detect and return the browser name.
const browser = detect();
Detect what device and browser you’re using.
// if is mobile const instance = isMobile(); // if is Android const instance = isAndroid(); // if is Chrome const instance = isChrome(); // if is Firefox const instance = isFireFox(); // if is Safari const instance = isSafari(); // if is MS Edge const instance = isEdge(); // if is IE const instance = isIE(); // if is Opera const instance = isOpera();