我正在尝试使用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
发布于 2020-05-04 12:42:26
我通过在本地下载文件并将脚本的源设置为该fingerprint2.js文件修复了此问题
发布于 2020-09-01 15:41:37
在我的例子中,下载所有github存储库并将其本地安装到我的插件文件夹中就可以了。在此之后,您可以再次缩小它。
https://stackoverflow.com/questions/61581997
复制相似问题