1

I’m developing web application by JavaScript. I now want to get the unique ID used to distinguish different PC devices.

The main requirement is the unique ID should be the same when different users logon to the system. And the unique ID should not be changed when the user clear the browser's data. When the user logon to the web app, we should get the same unique ID. So the unique ID may be relevant with the hardware of the device.

I want to know what is the best practice?

If you have any ideas, please tell me.

Xie Steven
  • 8,544
  • 1
  • 9
  • 23
  • 1
    What is a device ID? Long story short: browsers will do anything they can to prevent you from being able to uniquely identify a device. – Robby Cornelissen Jul 05 '22 at 05:39
  • @xie-steven you are looking for this Javascript API. `navigator.userAgent.toLowerCase()`. It's unique across browser/device. It outputs the browser's information uniquely and it doesn't change on reload or browser cache refresh. It prints __"mozilla/5.0 (windows nt 10.0; win64; x64; rv:101.0) gecko/20100101 firefox/101.0"__ when testing from my device; Notice the OS name, browser name and browser version are all unique here. – webblover Jul 05 '22 at 06:28

0 Answers0