User behavior statistics are commonplace in today's front-end ecology, such as a variety of webmaster statistics tools. Identifying user access client uniqueness is a necessary implementation, for device information acquired by the Web front end, Generally easy to think of is through the navigator.useragent, but the same device and browser UA is the same, so the identification of UA is very low, then the Web front-end to identify browser device uniqueness is there any other good way?
First of all, say fingerprint, which is what we often say fingerprint recognition, FINGERPRINTJS framework can go to GitHub to see the introduction, Web fingerprint recognition technology by extracting various features of the device, it is said to reach 94% of Anonymous browser sensitivity. Because this is not the focus of this article, it will not unfold here. So there's another way? Yes, and simple enough, but after all, the best for the scene, not necessarily better but it is worth a try.
You may have heard of a H5 Api:app cache, right, and then we'll use it to realize the uniqueness of the browser device. Let's take a look at a sample of 3 small files that are less than 1k in total:
1.index.html Business page, introducing uuid.html pages via IFRAME tags
2.uuid.appcache App cache required for a configuration file
3.uuid.html is introduced by an IFRAME in the index.html to maintain the cache page of the UUID.
The whole process is this:
1. The server generates a unique identification code, written in the uuid.html as a maintenance uuid, and labeled
2. User access index.html, after introducing uuid.html, the execution of JS can read to the UUID
3. Try to modify the UUID in the uuid.html, Access n times in the browser, and read the UUID is the first cached UUID.
In other words, by giving the user a code that cannot be destroyed, the purpose of identifying the browser device uniqueness is achieved.
A simple test server with python-m simplehttpserver 8080 can be tested using the built-in browser. Most of the devices that the composer has tested are feasible, especially in the built-in browser: The UUID does not clear even if the phone is turned off or restarted. Please use caution, if necessary, modify the UUID, in addition to modifying the URI of the access, you can also modify the Uuid.appcache or modify the uuid.html name.
The above is the entire content of this article, I hope that you are now considering the business to play a little help. Code attachments are routinely provided, and you need to be able to download them yourself, and finally thank you for your interest in Caramel (Jottown).
[Go] The Web front-end JS construct can not destroy the class UUID identification code, identify browser device uniqueness