我有一个特殊的需要,这给了我一些困难。基本要求是:我们需要通过一个ID来唯一地识别设备(可以是PC、Mac、平板电脑、电话),就像IMEI.这是需要的,因为一些申请的许可限制。
挑战:我们运行的是一个角度,而浏览器使得几乎不可能唯一地识别设备。由于我们使用的是浏览器沙箱,我没有机会获得类似Mac地址之类的东西,或者任何定义唯一ID的良好开端。
到目前为止我们尝试过的是:
- In one hand, on the first tests I made on my Chrome, it came empty and additionally it is not supported on Safari...- At a first sight we think we hit the Jackpot as it properly generated the same ID, even if I called it from an Anonymous window! But, It still generates another ID for a different browser...
- Basically It works by enumerating all browser capabilities(at least the ones accessible) and then by creating a hash of that... The Issue: If you have devices with exactly same configurations, they will have the same ID! I tried that on 2 iPhones that have the same config and were even bought on same day! :-)- If I open an Anonymous window, of course that the LocalStorage would be not there, meaning that I would get a new "UUID"
- Besides that, we have some individual angular applications and they would need to share the local storage, which is not possible to do due to the SameOrigin security Limitation. We could overcome it using an iFrame and the PostMessage ([https://levelup.gitconnected.com/share-localstorage-sessionstorage-between-different-domains-eb07581e9384](https://levelup.gitconnected.com/share-localstorage-sessionstorage-between-different-domains-eb07581e9384)). There are actuyll some NPM packages doing that as this one: [https://github.com/ofirdagan/cross-domain-local-storage](https://github.com/ofirdagan/cross-domain-local-storage). Being honest, we do not like much the idea of create a "cross-domain-local-storage"...我知道这个问题并不容易解决,但我想问是否有人面对这样的情况,他们是如何解决的。当然,如果我能够用完直接访问设备信息的浏览器沙箱,如MAC地址、IMEI或诸如此类的东西,那就很容易了,但如前所述,浏览器沙箱是限制性的.
想法?
提前谢谢!
佩德罗
发布于 2020-08-20 13:48:13
我要给你们看一个我在2018年写的答案,这个答案现在还是一样的:how can I get a unique device ID in javascript?
简单的回答是:你不能,真的。
您将无法获得任何唯一标识设备跨所有浏览器和匿名与常规。正如你所发现的,你可以接近,但这不是一件确定的事情。
你能做的最好的就是把几种技术结合在一起(比如指纹+存储的UID),它可能会得到99%的案例,但是你无法确定它们的全部。
https://stackoverflow.com/questions/63506374
复制相似问题