I'm diving into the world of device identification with fingerprintjs2, but encountering a roadblock due to my inexperience with Libraries. The error message I keep running into is
Uncaught ReferenceError: Fingerprint2 is not defined
.
Take a look at the code snippet that's causing me trouble:
<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>
I could really use some guidance on why this isn't functioning as expected. I've already done the yarn install to set things up.
Am I going about using javascript libraries incorrectly?
Furthermore, does anyone know if there are other methods for device recognition? So far, my research hasn't turned up any alternatives.
Edit:
My suspicion now rests on CORS being the issue, particularly based on the warning message:
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://cdnjs.com/libraries/fingerprintjs2 with MIME type text/html