怎样获取网页加载到现在的时间

可以在网页onload时存一个当前时间的时间戳, 后面需要用到时再用当前时间戳相减得到, 但还有更好的办法: 

performance.now(); // 295741.5400000755

 

performance.now() 会返回一个高精度的时间戳, 用于表示当前网页的加载时间.

posted on 2019-10-22 10:29  aisowe  阅读(1222)  评论(0编辑  收藏  举报

导航