0

我正在尝试使用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

4

2 回答 2

0

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

于 2020-09-01T07:41:37.303 回答
0

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

于 2020-05-04T04:42:25.697 回答