Re: [NavigationTiming] waiting for loadEventEnd to get set

I have this working for our pages that execute all the javascript as
part of the page generation (i.e. all contained in or called from the
django template). But we have pages that have an onchange function
that gets triggered by something done in the template. In those the
loadEventEnd gets set before the onchange function runs. Any idea how
I can get the time the onchange function takes included in the
navigation timing?

On Fri, Jul 6, 2012 at 7:25 AM, Patrick Meenan <pmeenan@webpagetest.org> wrote:
> loadEventStart is the beginning of when the load event fires and is
> the point where the static page has finished loading. loadEventEnd
> adds the amount of time that is needed to execute JavaScript code
> attached to the load event.
>
> in practice they are usually close but technically you want
> loadEventStart to know when the browser finished loading the page
> content.
>
>
> -----------------
> Sent from my slab of glass with no keyboard so it will be a miracle if
> you receive what I meant to type.
>
> On Jul 6, 2012, at 8:42 AM, Larry Martell <larry.martell@gmail.com> wrote:
>
>> On Fri, Jul 6, 2012 at 5:24 AM, Patrick Meenan <pmeenan@webpagetest.org> wrote:
>>> Try a 0-length setTimeout. LoadEventEnd can't be set until the
>>> execution of all onload handlers completes (including the one you are
>>> using to measure).
>>
>> Thanks. That worked.
>>
>>> You could also just use loadEventStart which is probably what you want
>>> from what you describe anyway.
>>
>> I am trying to measure how long it takes for the browser to render the
>> page after it has received all the data from the server.  So don't I
>> need loadEventEnd for that?
>>
>>
>>> On Jul 6, 2012, at 3:49 AM, Larry Martell <larry.martell@gmail.com> wrote:
>>>
>>>> I'm trying to use the Navigation Timing package to measure how long a
>>>> page takes to be rendered. So that would be loadEventEnd-responseEnd,
>>>> however I am finding that loadEventEnd is always 0 for me, even though
>>>> I am accessing it from within a window.onload function, e.g:
>>>>
>>>> window.onload = function() {
>>>>   var t = performance.timing;
>>>>   var render_time = parseInt(t['loadEventEnd']) - parseInt(t['responseEnd']);
>>>> }
>>>>
>>>> If I check in the console after the page is loaded it does have a
>>>> value.  What event do I have to wait for before loadEventEnd gets set?
>>>>
>>>>
>>>> Thanks!
>>>> -larry
>>>>
>>>>

Received on Sunday, 8 July 2012 01:15:08 UTC