I've written a tiny plugin that gets the page load/render time. It collects the finish time at $(document).ready and I've put the code snippet that collects the start time right after the <title>
tag.
I'd like this to be less obtrusive, so it seems there should be an earlier event than .ready where I can collect the earliest measurable page start time.
Here is the currently obtrusive javascript
<title></title>
<script type="text/javascript">
var startTime = (new Date()).getTime();
</script>
Here is the plugin:
(function ($) {
$(document).ready(function () {
var endTime = (new Date()).getTime();
var millisecondsLoading = endTime - startTime;
$.get('hicmah.ashx?duration=' + millisecondsLoading, function (data) {
});
});
})(jQuery);