【问题标题】:How do I use the fingerprintjs2 library?如何使用指纹js2库?
【发布时间】:2020-05-03 21:41:10
【问题描述】:

我正在尝试使用fingerprintjs2 来识别设备。但是,我是使用库的新手,我收到错误 Uncaught ReferenceError: Fingerprint2 is not defined

这是我的代码:

<script src="https://github.com/Valve/fingerprintjs2"></script>
<script>
    if (window.requestIdleCallback) {
        requestIdleCallback(function () {
            Fingerprint2.get(function (components) {
                console.log(components) // an array of components: {key: ..., value: ...}
            })
        })
    } else {
        setTimeout(function () {
            Fingerprint2.get(function (components) {
                console.log(components) // an array of components: {key: ..., value: ...}
            })
        }, 500)
    }
</script>

谁能告诉我为什么这不起作用?我已经为此安装了纱线。

这不是使用 javascript 库的正确方法吗?

另外,请告诉我是否有任何替代记忆设备的方法,但是,据我进行一些研究,似乎没有。

编辑:

我现在认为这可能与 CORS 有关,因为它会发出警告:Cross-Origin Read Blocking (CORB) blocked cross-origin response https://cdnjs.com/libraries/fingerprintjs2 with MIME type text/html

【问题讨论】:

  • 使用https://cdnjs.com/libraries/fingerprintjs2而不是github url
  • 它仍然给出同样的错误

标签: javascript fingerprintjs2


【解决方案1】:

我通过在本地下载文件并将脚本的源设置为 fingerprint2.js 文件解决了这个问题

【讨论】:

    【解决方案2】:

    在我的情况下,下载所有 github 存储库并将其安装在我的插件文件夹中本地工作。之后,您可以再次缩小它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-07-28
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多