给博客底部添加页面加载时长

2023-07-17 19:17:39 浏览数 (1)

# Step one

*找到底部代码添加一个块标签,添加如下代码* ```html

``` # Step two *找到底部代码的script标签里面,添加如下代码* ```html window.onload = function () { var loadTime = window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart; $("#timeShow").html('加载本页耗时 ' loadTime 'ms'); }

```

# Step three

0 人点赞