What is window.performance.timing.{navigationStart,requestStart,fetchStart} set to for prerendered pages?

726 views
Skip to first unread message

bluesmoon

unread,
Jun 15, 2011, 2:00:49 PM6/15/11
to Prerender
Hi,

So if a page is prefetched and prerendered by the browser, what would
window.performance.timing.requestStart,
window.performance.timing.fetchStart and
window.performance.timing.navigationStart be set to for that
particular page?

I'm referring to the NavigationTiming API described here:
https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
and implemented by Chrome.

Thanks,

Philip

bluesmoon

unread,
Jun 15, 2011, 2:03:45 PM6/15/11
to Prerender
And related, when does onload fire?

Ziga Mahkovec

unread,
Jun 15, 2011, 2:22:13 PM6/15/11
to Prerender, bluesmoon
The navigation timing metrics and onload handler are unaffected by
prerendering -- they will behave as if the page was actually navigated
to.

To detect when the prerendered page is shown (and adjust page load
times), you may use the Visibility API:
http://code.google.com/chrome/whitepapers/pagevisibility.html

--
Ziga

Philip Tellis

unread,
Jun 15, 2011, 2:31:14 PM6/15/11
to Ziga Mahkovec, Prerender
Thanks for the quick reply. so just to clarify,

window.performance.timing.navigationStart will be the timestamp when
chrome started prefetching the page and this will (in most cases) be
the same as fetchStart and requestStart. Is this correct?

Also, window.performance.navigation.type == TYPE_NAVIGATE. Is this correct?

Lastly, onload might fire before the page changes to state "hidden" or
"visible". Is this correct?

Ziga Mahkovec

unread,
Jun 15, 2011, 3:03:07 PM6/15/11
to Prerender, Philip Tellis, Ziga Mahkovec
Correct, I just verified this with a test page on http://prerender-test.appspot.com.
I logged these in an onload handler:

document.webkitVisibilityState: prerender
window.performance: {[...],"timing":{"[...],"fetchStart":
1308164240720,"requestStart":1308164240724,"navigationStart":
1308164240720},"navigation":{"redirectCount":0,"type":0}}

--
Ziga

Philip Tellis

unread,
Jun 15, 2011, 3:06:56 PM6/15/11
to Ziga Mahkovec, Prerender
thanks a lot
Reply all
Reply to author
Forward
0 new messages