v3.8.0
about 2 years ago by Sergey Mostsevenko
- Fallback endpoint. You can set multiple endpoints; JavaScript agent will try to send the request with the first endpoint, and if the request fails, retry the request with the second endpoint and so on. Supported by all options: scriptUrlPattern, endpoint and tlsEndpoint.
- Placeholder values for cases where you want to use the default endpoint as a fallback endpoint:
FingerprintJS.defaultScriptUrlPattern
for scriptUrlPatternFingerprintJS.defaultEndpoint
for endpointFingerprintJS.defaultTlsEndpoint
for tlsEndpoint
import * as FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
const fpPromise = FingerprintJS.load({
apiKey: '<<browserToken>>',
scriptUrlPattern: [
'/myproxy/v<version>/<apiKey>/loader_v<loaderVersion>.js',
FingerprintJS.defaultScriptUrlPattern,
],
endpoint: [
'https://fp.example.com',
'https://fp2.example.com',
FingerprintJS.defaultEndpoint,
],
tlsEndpoint: [
'https://tls.example.com',
FingerprintJS.defaultTlsEndpoint,
],
})
// ...
// Fallback CDN urls aren't supported by the CDN installation method.
// Use the NPM method instead or implement the fallback mechanism manually.
const fpPromise = import('https://fpjscdn.net/v3/<<browserToken>>')
.then(FingerprintJS => FingerprintJS.load({
endpoint: [
'https://fp.example.com',
'https://fp2.example.com',
FingerprintJS.defaultEndpoint,
],
tlsEndpoint: [
'https://tls.example.com',
FingerprintJS.defaultTlsEndpoint,
],
})
// ...