I was just admiring Tim Kadlec eye-pleasing site. Nice, simple, see what I'm talkin' 'bout.
我只是欣赏Tim Kadlec令人赏心悦目的站点。 很好,很简单,看看我在说什么。

The feature I liked most was the footer that said "This page loaded in 0.186 seconds". First of all - fast! Second - I thought all sites should have that. And what better way than an on-demand bookmarklet you carry yourself in your daily browsing?
我最喜欢的功能是页脚所说的“此页面在0.186秒内加载”。 首先-快速! 第二-我认为所有网站都应该有。 在日常浏览中,有什么比按需收藏的书签更好的方式呢?
So any time you say to yourself "wow, that was painfully slow" or "weee, my hat flew off!", you can answer the simple question of how long it actually took. Cause perceptions lie.
所以,任何时候你会对自己说:“哇,这是痛苦的缓慢”或“WEEE,我的帽子飞走了!”,你能回答的,它实际上花了多长时间了简单的问题。 原因造成谎言。
Anyway, here's the simple code lifted and modified from Tim's:
无论如何,这是从Tim提出并修改的简单代码:
(function(){
const t = window.performance && performance.timing;
if (!t) {
return;
}
const loadTime = (t.loadEventEnd - t.navigationStart) / 1000;
alert(`This page loaded in ${loadTime} seconds`);
}())
And here's the bookmarklet form - click to try and then just drag to your bookmarks.
这是小书签的形式-单击以尝试,然后将其拖到您的书签中。
load time
加载时间
Enjoy and let's make the web faster!
尽情享受,让我们更快地上网!
Tell your friends about this post on Facebook and Twitter
在Facebook和Twitter上告诉您的朋友有关此帖子的信息
翻译自: https://www.phpied.com/this-page-loaded-in-x-seconds/