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