On Mon, Jun 25, 2012 at 6:56 AM, Melvyn Sopacua <m.r.sopa...@gmail.com> wrote:
> On 25-6-2012 14:00, Larry Martell wrote:
>> On Mon, Jun 25, 2012 at 5:56 AM, bruno desthuilliers
>> <bruno.desthuilli...@gmail.com> wrote:
>>> On Monday, June 25, 2012 1:34:08 PM UTC+2, larry....@gmail.com wrote:
>>>>
>>>>  Now they want me to add to that how long
>>>> the browser takes to render the page
>>>
>>>
>>> How would server code ever know this ?
>>
>> My assumption is that it would be collected or calculated on the
>> client side and sent back to the server. But I have no clue how that
>> could be done (or even if it could be done).
>>
>
> The issue is what your client's definitions are.
> A browser starts rendering as soon it receives data. Is that your
> starting point?
> If your definition is that "as soon as all data is received" and until
> browser has fully displayed things, this is a bit more difficult. First,
> there's no event for this. The closest approximation is
> "DOMContentLoaded", which is used by JQuery's documentready. The
> difference between "all data received" and "DOM parsing done" is the cpu
> cycles it takes to parse the main DOM tree. Since your clients already
> are asking for fractions of seconds in the common case, this is significant.
>
> Secondly, window.onload is your stoptime event, but this doesn't fire
> until /everything/ is loaded. This means any networking problems with
> content have to time out, but for the end user, everything displays
> correctly. In fact, a user can click on to the next page before this
> even fires.
>
> So, reliably, you can't really do this and your best approximation is
> the event firing times for window.onload minus DOMContentLoaded, or
> JQuery's $(document).ready [1].
> You can embed the row id for your statistics as a JavaScript variable in
> your template.
> And finally, you'd send the calculation back using Ajax requests,
> something you'll find plenty of howto's for on the web.
>
> [1]
> <http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery>

Thanks for the reply Melvyn. I'll be investigating these solutions.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to