Created
August 11, 2014 07:30
-
-
Save manuelvanrijn/dd538f9888a4d3e54dbe to your computer and use it in GitHub Desktop.
Javascript clientside GUID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It returned same guid for 2 different PC in my company.