1

I would like to know if dynamic content has any effect on the timing values like loadEnd etc. For example, I conditionally change 'src' attribute of an image in my code using jquery, after loading the page. How is this handled? I tried testing it by checking the values before and after I load the image, it doesn't look like the values change after this image is loaded. Does that mean the navigation timing API does not include dynamic content loading?

explunit
  • 18,967
  • 6
  • 69
  • 94
user1355348
  • 159
  • 2
  • 4
  • related: http://stackoverflow.com/questions/14657849/can-i-use-the-browser-navigation-timing-api-for-ajax-events-in-single-page-apps?rq=1 – Thilo Apr 26 '13 at 06:59

1 Answers1

0

The value of the loadEventEnd NavigationTiming property is set once the document's load event has fired and returns:

loadEventEnd attribute

This attribute must return the time when the load event of the current document is completed. It must return zero when the load event is not fired or is not completed.

From your statement:

... I conditionally change 'src' attribute of an image in my code using jquery, after loading the page...

It sounds like you are changing the a src attribute either during or after the body's load event has fired. Since the load event only ever fires once on a page, the window.performance.timing.loadEventEnd property will never change once it is set to a non-zero value. So it will not reflect the additional time it's taking to download the new img src.

If you wanted to include the time that it takes to download the additional image that you're changing the src on, you could hook into that image's load event. Once that event fires, compare Date.now() to navigationStart instead of loadEventEnd to get the total elapsed page load time.

NicJ
  • 4,070
  • 1
  • 25
  • 18