此页面在X秒内加载

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

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/this-page-loaded-in-x-seconds/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值