1

有没有办法使指纹js2生成的唯一哈希码即使在刷新后在隐身模式下也相同?

这是我的代码,可能代码有错误?

 const Fingerprint2 = require("fingerprintjs2");

 var options = {}
 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)
}

Fingerprint2.get(options, function (components) {
var values = components.map(function (component) { return component.value })
var murmur = Fingerprint2.x64hash128(values.join(''), 31)

console.log(murmur) // provides a hash
})

问题是,在正常浏览模式下,哈希保持不变,但在隐身模式下,它会在重新浏览等后发生变化

如果在隐身模式下哈希不会改变,我会很满意,即使它是 difffirenet 然后在正常浏览模式下。

感谢您的帮助,我不是 javascript 专家,提供的任何帮助都会很有用。

4

1 回答 1

0

在选项中,您可以设置doNotTrack为 false

Fingerprint2.getV18({
    excludes: {
        doNotTrack: false
    }
}, (murmur, components) => {
    // murmur => your calculated hash
})
于 2020-07-24T12:01:43.970 回答