快乐双彩什么时候开奖结果:This page loaded in X seconds

March 27th, 2018. Tagged: bookmarklets, JavaScript, performance

I was just admiring Tim Kadlec eye-pleasing site. Nice, simple, see what I'm talkin' 'bout.

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?

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.

Anyway, here's the simple code lifted and modified from Tim's:

(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: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile, hit me up on twitter @stoyanstefanov


  • “四新”彰显党的十九大思想灵魂和精髓要义 2018-08-17
  • 热身赛-U17女篮73-68立陶宛 杨舒宇19分刘禹彤13分 2018-08-16
  • 七月流火:一半是甜蜜 一半是仁慈 2018-08-15
  • “嫦娥”飞向月球背面,将会揭开哪些秘密? 2018-08-15
  • 一代枭雄身后事:“曹操墓”认定过程缘何一波三折? 2018-08-04
  • 女出纳侵吞千万公款扮富婆 7年未被公司发现 2018-08-04
  • 南昌PM2.5浓度写进目标责任书 切实防治大气污染 2018-07-20
  • 网友投诉不文明养犬行为 有关部门加强治理 2018-07-20
  • 868| 713| 313| 654| 906| 523| 515| 314| 111| 763|