介绍

FingerprintJS 是一个源代码可用的客户端浏览器指纹识别库,可查询浏览器属性并根据这些属性计算哈希访客标识符。与 Cookie 和本地存储不同,指纹在隐身/隐私模式下保持不变,即使浏览器数据被清除也是如此。

github: https://github.com/fingerprintjs/fingerprintjs

测试用例

https://stackblitz.com/edit/fpjs-4-cdn?devtoolsheight=100&file=index.html

<script>
  // Initialize the agent at application startup.
  const fpPromise = import('https://openfpcdn.io/fingerprintjs/v4')
    .then(FingerprintJS => FingerprintJS.load())

  // Get the visitor identifier when you need it.
  fpPromise
    .then(fp => fp.get())
    .then(result => {
      // This is the visitor identifier:
      const visitorId = result.visitorId
      console.log(visitorId)
    })
    .catch(error => console.error(error))
</script>

返回当前浏览器指纹。类似

e625d944e21fd5885657b367c3b2952e