Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example showing in page timers that can be used as a fall back when the Navigation Timing API is not available.
<!doctype html>
<html>
<head>
<script>window.t_pagestart = new Date().getTime();</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>In page timer example</title>
</head>
<body>
<h1>Lorem ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<script src="jquery.js"></script>
<script>
$(document).ready(function () {
window.t_domready = new Date().getTime();
});
</script>
</body>
</html>
@Jonic

This comment has been minimized.

Copy link

commented May 8, 2013

If your script's executing at the very bottom of the document, you more than likely don't need the DOM ready event, because the DOM's already there and loaded.

Also, If you just want to do simple timing, you can do that in the console, although it looks like this is only useful if you don't then need to do anything with the value it returns: https://developers.google.com/chrome-developer-tools/docs/console#measuring_how_long_something_takes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.