Skip to content

Latest commit

 

History

History
105 lines (80 loc) · 2.46 KB

browser_support.md

File metadata and controls

105 lines (80 loc) · 2.46 KB

Browser support

The library supports all popular browsers. We use the following command to determine which browsers to support:

npx browserslist "cover 96% in us, not IE < 11"

At the moment, these browsers are:

Other browsers will probably also work, but we don't guarantee it.

Old browsers requirements

import() support

If you use the "Browser ECMAScript module" installation methods, you may have an error. Old browsers don't support import. Replace it with a <script> tag:

+ // Note that we use iife.min.js with older browsers
+ <script src="https://openfpcdn.io/botd/v1/iife.min.js"></script>
  <script>
-   const botdPromise = import('https://openfpcdn.io/botd/v1')
-     .then(BotD => BotD.load())
+   var botdPromise = BotD.load()

    // ...
  </script>

Polyfills

Very old browsers like Internet Explorer 11 and Android Browser 4.4 require a Promise polyfill to work. Add a Promise polyfill before loading the BotD agent. Examples for various installation methods:

Webpack/Rollup/NPM/Yarn

# Install the polyfill package first:
npm i promise-polyfill
# or
yarn add promise-polyfill
+ import 'promise-polyfill/src/polyfill'
  import BotD from '@fingerprintjs/botd'

  // ...

UMD

  require(
    [
      'https://openfpcdn.io/botd/v1/umd.min.js',
+     'https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js',
    ],
    function (BotD) {
      // ...
    }
  )

CommonJS syntax:

+ require('promise-polyfill/src/polyfill')
  const BotD = require('@fingerprintjs/botd')

  // ...

Code syntax

Old browsers like IE11 don't support const, let and arrow functions (=>). Use var and the classic function syntax instead:

- const botdPromise = BotD.load()
+ var botdPromise = BotD.load()

  botdPromise
-   .then(fp => fp.detect())
+   .then(function (fp) { return fp.detect() })
-   .then(result => {
+   .then(function (result) {
      // Handle the result
    })