fingerprint2库,在github上有
<html>
<head>
<title>浏览器指纹,实现用户免登陆状态</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/2.0.6/fingerprint2.min.js"></script>
</head>
<body>
<script>
var my_hasher = function(value, seed){ return value.length % seed; };
if (window.requestIdleCallback) {
requestIdleCallback(function () {
Fingerprint2.get(function (components) {
var values = components.map(function (component) { return component.value });
var murmur = Fingerprint2.x64hash128(values.join(''), 31);
console.log("用户标识-->" + murmur);
alert(murmur);
})
})
} else {
setTimeout(function () {
Fingerprint2.get(function (components) {
var values = components.map(function (component) { return component.value });
var murmur = Fingerprint2.x64hash128(values.join(''), 31);
console.log("用户标识-->" + murmur);
alert(murmur);
})
}, 500)
}
</script>
</body>
</html>
扫描二维码,分享此文章