JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 523482
  • Score
    100M100P100Q184669F
  • License MIT

A small lib to detect browser compatibility for braintree products

Package Exports

  • @braintree/browser-detection
  • @braintree/browser-detection/dist/browser-detection.js
  • @braintree/browser-detection/is-android
  • @braintree/browser-detection/is-android.js
  • @braintree/browser-detection/is-chrome
  • @braintree/browser-detection/is-chrome-os
  • @braintree/browser-detection/is-chrome-os.js
  • @braintree/browser-detection/is-chrome.js
  • @braintree/browser-detection/is-edge
  • @braintree/browser-detection/is-edge.js
  • @braintree/browser-detection/is-firefox
  • @braintree/browser-detection/is-firefox.js
  • @braintree/browser-detection/is-ie
  • @braintree/browser-detection/is-ie.js
  • @braintree/browser-detection/is-ie10
  • @braintree/browser-detection/is-ie10.js
  • @braintree/browser-detection/is-ie9
  • @braintree/browser-detection/is-ie9.js
  • @braintree/browser-detection/is-ios
  • @braintree/browser-detection/is-ios-safari
  • @braintree/browser-detection/is-ios-safari.js
  • @braintree/browser-detection/is-ios-webview
  • @braintree/browser-detection/is-ios-webview.js
  • @braintree/browser-detection/is-ios-wkwebview
  • @braintree/browser-detection/is-ios-wkwebview.js
  • @braintree/browser-detection/is-ios.js
  • @braintree/browser-detection/is-mobile-firefox
  • @braintree/browser-detection/is-mobile-firefox.js
  • @braintree/browser-detection/is-samsung
  • @braintree/browser-detection/is-samsung.js
  • @braintree/browser-detection/supports-payment-request-api
  • @braintree/browser-detection/supports-payment-request-api.js
  • @braintree/browser-detection/supports-popups
  • @braintree/browser-detection/supports-popups.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@braintree/browser-detection) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Browser Detection

A utility for detecting browser support for Braintree libs.

Example

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");

Testing

npm test

Notes on isIpadOs

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

Notes on Safari

is-safari is used for desktop Safari detection, if you are trying to detect an iOS version of Safari, use is-ios-safari.