Created
February 10, 2015 11:58
-
-
Save danreeves/be1ef42b95c3c006144b to your computer and use it in GitHub Desktop.
Times the page load. Taken from http://timkadlec.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function(){ | |
setTimeout(function(){ | |
window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; | |
var t = performance.timing || {}; | |
if (!t) { | |
//fail silently | |
return; | |
} | |
var start = t.navigationStart, | |
end = t.loadEventEnd | |
loadTime = (end - start) / 1000; | |
var copy = document.getElementsByClassName('copy'); | |
copy[0].innerHTML += "<span class='loaded'>This page loaded in <strong>" + loadTime + " seconds</strong>.</span>"; | |
}, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment