Created
July 24, 2012 06:58
-
-
Save riix/3168482 to your computer and use it in GitHub Desktop.
페이지 로드 시간 얻기, Get Page Load Time
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
var beforeload = (new Date()).getTime(); // calculate the time before calling the function in window.onload | |
function getPageLoadTime() { | |
var afterload = (new Date()).getTime(); // calculate the current time in afterload | |
seconds = (afterload - beforeload) / 1000; // now use the beforeload and afterload to calculate the seconds | |
console.log('Page load time : ' + seconds + ' sec(s).'); // Place the seconds in the innerHTML to show the results | |
} | |
window.onload = getPageLoadTime; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment