html - Javascript: Page load time -
how calculate time takes load page , display it? using snippet got online , modified display preference. there better way calculate time takes page load?
note: ladezeit
date time in german.
<!--begin_loadtime--> <script type="text/javascript"> ladestart = new date(); function ladezeit() { current = new date(); dtime = current.gettime() - ladestart.gettime(); loadtime = dtime/1000 +" seconds page load time."; document.getelementbyid("ladezeit-anzeige").innerhtml = loadtime; } </script> <body onload="ladezeit()"> <div id="ladezeit-anzeige" style="position: absolute; top: 5px; left: 10px;"></div> <!--end_loadtime-->
page load speed depends on many factors, includes time takes load external files, such css, js, images, , etc , how fast webserver responds. using on page javascript commands detect page load speed flawed doesn't count how fast server responds , etc.
to check how fast page load, might use tools, such https://developers.google.com/speed/pagespeed/.
Comments
Post a Comment