Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
@braintree/browser-detection
Advanced tools
A small lib to detect browser compatibility for braintree products
@braintree/browser-detection is a utility library for detecting various browser features and characteristics. It helps developers to identify the browser type, version, and specific capabilities, allowing for more tailored and compatible web experiences.
Detect if the browser is Internet Explorer
This feature allows you to check if the current browser is Internet Explorer. It returns a boolean value indicating the presence of IE.
const browserDetection = require('@braintree/browser-detection');
const isIE = browserDetection.isIe();
console.log(isIE); // true or false
Detect if the browser is Edge
This feature allows you to check if the current browser is Microsoft Edge. It returns a boolean value indicating the presence of Edge.
const browserDetection = require('@braintree/browser-detection');
const isEdge = browserDetection.isEdge();
console.log(isEdge); // true or false
Detect if the browser is Chrome
This feature allows you to check if the current browser is Google Chrome. It returns a boolean value indicating the presence of Chrome.
const browserDetection = require('@braintree/browser-detection');
const isChrome = browserDetection.isChrome();
console.log(isChrome); // true or false
Detect if the browser is Safari
This feature allows you to check if the current browser is Safari. It returns a boolean value indicating the presence of Safari.
const browserDetection = require('@braintree/browser-detection');
const isSafari = browserDetection.isSafari();
console.log(isSafari); // true or false
Detect if the browser is Firefox
This feature allows you to check if the current browser is Mozilla Firefox. It returns a boolean value indicating the presence of Firefox.
const browserDetection = require('@braintree/browser-detection');
const isFirefox = browserDetection.isFirefox();
console.log(isFirefox); // true or false
Bowser is a small, fast, and rich-API browser detector library. It provides detailed information about the browser, including the name, version, and platform. Compared to @braintree/browser-detection, Bowser offers more granular details and a wider range of detected browsers and platforms.
Detect-browser is a lightweight library for detecting browser details. It provides information about the browser name, version, and operating system. It is similar to @braintree/browser-detection but focuses on simplicity and ease of use.
UA-Parser-JS is a comprehensive user-agent string parser that can detect browser, engine, OS, CPU, and device type. It offers more detailed detection capabilities compared to @braintree/browser-detection, making it suitable for more complex use cases.
A utility for detecting browser support for Braintree libs.
const browserDetection = require("browser-detection");
browserDetection.isAndroid();
browserDetection.isChromeOS();
browserDetection.isChrome();
browserDetection.isDuckDuckGo();
browserDetection.isEdge();
browserDetection.isFirefox();
browserDetection.isSafari();
browserDetection.isIe();
browserDetection.isIe9();
browserDetection.isIe10();
browserDetection.isIe11();
browserDetection.isIos();
browserDetection.isIosFirefox();
browserDetection.isIosGoogleSearchApp();
browserDetection.isIosSafari();
browserDetection.isIosWebview();
browserDetection.isIosUIWebview();
browserDetection.isIosWKWebview();
browserDetection.isIpadOS();
browserDetection.isMobileFirefox();
browserDetection.isOpera();
browserDetection.isSamsungBrowser();
browserDetection.isSilk();
browserDetection.hasSoftwareKeyboard();
browserDetection.supportsPaymentRequestApi();
browserDetection.supportsPopups();
To reduce build sizes, you can require just the modules you need:
const isAndroid = require("browser-detection/is-android");
const isChromeOS = require("browser-detection/is-chrome-os");
const isChrome = require("browser-detection/is-chrome");
const isDuckDuckGo = require("browser-detection/is-duckduckgo");
const isEdge = require("browser-detection/is-edge");
const isFirefox = require("browser-detection/is-firefox");
const isSafari = require("browser-detection/is-safari");
const isIe = require("browser-detection/is-ie");
const isIe9 = require("browser-detection/is-ie9");
const isIe10 = require("browser-detection/is-ie10");
const isIe11 = require("browser-detection/is-ie11");
const isIos = require("browser-detection/is-ios");
const isIosFirefox = require("browser-detection/is-ios-firefox");
const isIosGoogleSearchApp = require("browser-detection/is-ios-google-search-app");
const isIosSafari = require("browser-detection/is-ios-safari");
const isIosWebview = require("browser-detection/is-ios-webview");
const isIosUIWebview = require("browser-detection/is-ios-uiwebview");
const isIosWKWebview = require("browser-detection/is-ios-wkwebview");
const isIpadOS = require("browser-detection/is-ipados");
const isMobileFirefox = require("browser-detection/is-mobile-firefox");
const isOpera = require("browser-detection/is-opera");
const isSamsungBrowser = require("browser-detection/is-samsung");
const isSilk = require("browser-detection/is-silk");
const hasSoftwareKeyboard = require("browser-detection/has-software-keyboard");
const suportsPaymentRequestApi = require("browser-detection/supports-payment-request-api");
const supportsPopups = require("browser-detection/supports-popups");
npm test
isIpadOS
is a new option for browser detection, and is also included in isIos. isIos defaults to checking for iPads to maintain consistent behavior with how it acted in the past. If checkIpadOS
is set to false, then it will only check for older gen iPads and current iOS
const browserDetection = require("browser-detection");
const ua = window.navigator.userAgent;
// assume ua is from iPadOs 13 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15"
browserDetection.isIos(ua);
// will return true
browserDetection.isIos(ua, false);
// will return false
is-safari
is used for desktop Safari detection, if you are trying to detect an iOS version of Safari, use is-ios-safari
.
2.0.1
FAQs
A small lib to detect browser compatibility for braintree products
The npm package @braintree/browser-detection receives a total of 267,106 weekly downloads. As such, @braintree/browser-detection popularity was classified as popular.
We found that @braintree/browser-detection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.