网上的一些回复有很多,反正就是获取不到h5的机器码,或者mac地址,所以只能获取浏览器唯一标识。
fingerprint获取的方式,代码:
const fpPromise = new Promise((resolve, reject) => {
const script = document.createElement('script')
script.onload = resolve
script.onerror = reject
script.async = true
script.src = 'https://cdn.jsdelivr.net/npm/'
+ '@fingerprintjs/fingerprintjs@3/dist/fp.min.js'
document.head.appendChild(script)
})
.then(() => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
})