Skip to content

Instantly share code, notes, and snippets.

@manuelvanrijn
Created August 11, 2014 07:30
Show Gist options
  • Save manuelvanrijn/dd538f9888a4d3e54dbe to your computer and use it in GitHub Desktop.
Save manuelvanrijn/dd538f9888a4d3e54dbe to your computer and use it in GitHub Desktop.
Javascript clientside GUID
/**
* @function _guid
* @description Creates GUID for user based on several different browser variables
* It will never be RFC4122 compliant but it is robust
* @returns {Number}
* @private
*/
var guid = function() {
var nav = window.navigator;
var screen = window.screen;
var guid = nav.mimeTypes.length;
guid += nav.userAgent.replace(/\D+/g, '');
guid += nav.plugins.length;
guid += screen.height || '';
guid += screen.width || '';
guid += screen.pixelDepth || '';
return guid;
};
@zcmgyu
Copy link

zcmgyu commented Feb 4, 2020

It returned same guid for 2 different PC in my company.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment