Skip to content

Instantly share code, notes, and snippets.

@riix
Created July 24, 2012 06:58
Show Gist options
  • Save riix/3168482 to your computer and use it in GitHub Desktop.
Save riix/3168482 to your computer and use it in GitHub Desktop.
페이지 로드 시간 얻기, Get Page Load Time
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