Date.now() | 您所在的位置:网站首页 › js获取时间戳10位数 › Date.now() |
为了提供针对定时攻击和指纹追踪的保护,Date.now() 的精度可能会根据浏览器的高级设置项目而被取整。 在 Firefox 中,默认启用 privacy.reduceTimerPrecision 设置项,在 Firefox 59 中,默认被取整至 20 微秒;在 Firefox 60 中,则被取整至 2 毫秒。 js // reduced time precision (2ms) in Firefox 60 Date.now(); // 1519211809934 // 1519211810362 // 1519211811670 // ... // reduced time precision with `privacy.resistFingerprinting` enabled Date.now(); // 1519129853500 // 1519129858900 // 1519129864400 // ...在 Firefox 中,还可以通过启用 privacy.resistFingerprinting 来进一步降低精度。启用后,精度将为 100 毫秒或者 privacy.resistFingerprinting.reduceTimerPrecision.microseconds 的值,取决于这两个值中哪一个更大,也就是,精度更低一些。 |
CopyRight 2018-2019 实验室设备网 版权所有 |