js获取浏览器唯一标识(同电脑不同浏览器值不同)

我用QQ浏览器的谷歌内核和谷歌浏览器打开的值是相同的,用搜狗浏览器的急速内核和谷歌浏览器的值是不同的
同个浏览器的ie内核和急速内核的值是不同的


	function cans() {
		var canvas = document.createElement('canvas');
		var ctx = canvas.getContext('2d');
		var txt = 'http://security.tencent.com/';
		ctx.textBaseline = "top";
		ctx.font = "14px 'Arial'";
		ctx.textBaseline = "tencent";
		ctx.fillStyle = "#f60";
		ctx.fillRect(125, 1, 62, 20);
		ctx.fillStyle = "#069";
		ctx.fillText(txt, 2, 15);
		ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
		ctx.fillText(txt, 4, 17);

		var b64 = canvas.toDataURL().replace("data:image/png;base64,", "");
		var bin = atob(b64);
		var crc = bin2hex(bin.slice(-16, -12));
		//var crc = bin.slice(-16,-12);
		alert(crc);
	}

function bin2hex(str) {
		var result = "";
		for (i = 0; i < str.length; i++) {
			result += int16_to_hex(str.charCodeAt(i));
		}
		return result;
	}

	function int16_to_hex(i) {
		var result = i.toString(16);
		var j = 0;
		while (j + result.length < 4) {
			result = "0" + result;
			j++;
		}
		return result;
	}
	

原文地址:https://blog.csdn.net/javakeffer/article/details/48803165

 

你可能感兴趣的:(js)