【问题标题】:How to create a hash that in incognito mode stays the same even after browser refreshs with fingerprintjs2?即使在使用指纹js2刷新浏览器后,如何创建在隐身模式下保持不变的哈希?
【发布时间】:2020-09-24 16:47:13
【问题描述】:

有没有办法让指纹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
})

问题是,在正常浏览模式下,哈希保持不变,但在隐身模式下,它会在 refresing 和 e.t.c 后发生变化

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

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

【问题讨论】:

    标签: javascript incognito-mode fingerprintjs2


    【解决方案1】:

    在选项中你可以将doNotTrack设置为false

    Fingerprint2.getV18({
        excludes: {
            doNotTrack: false
        }
    }, (murmur, components) => {
        // murmur => your calculated hash
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-06
      • 1970-01-01
      • 1970-01-01
      • 2011-02-23
      • 2016-09-07
      • 2012-02-14
      相关资源
      最近更新 更多