WebPagetest Forums
unLoadEvent Actions Captured? - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Discuss Test Results (/forumdisplay.php?fid=4)
+--- Thread: unLoadEvent Actions Captured? (/showthread.php?tid=12588)

unLoadEvent Actions Captured? - ben.hastings - 10-07-2013 10:47 PM

We're using the window.onLoad event to trigger our window.performance.timing.* collection beacon, and that's been working really well for us.

We're venturing into deeper territory for our RUM data to capture details from the window.performance.getEntries().* interface. To date, we've done this with an offset beyond the loadEventEnd. However, we want to get a more complete view of resources delivered to our customers, so we _also_ want to fire a beacon on the unLoad event for the page.

I understand that doing "first-view-only" tests wouldn't trigger this behavior. However, I've run a couple of samples with the repeat first and second view option enabled and I'm not seeing the request triggered.

Is that expected behavior?

RE: unLoadEvent Actions Captured? - pmeenan - 10-07-2013 11:16 PM

Yes, the repeat view tests are done by closing the browser and re-launching it without clearing the cache. You need to use the scripting support to trigger a multi-step navigation to see it.

Something like:

navigate http://www.example.com/
navigate http://www.example.com/someotherpage.html

RE: unLoadEvent Actions Captured? - ben.hastings - 10-07-2013 11:20 PM

ahh... that makes sense. I'll give that a shot.

RE: unLoadEvent Actions Captured? - robzilla - 10-08-2013 12:24 AM

The closing of the browser window (which happens in "first-view-only" tests, too) should also trigger the onunload event, shouldn't it? I'm using beforeunload myself, but haven't gotten it to work with Firefox just yet...

RE: unLoadEvent Actions Captured? - ben.hastings - 10-08-2013 12:26 AM

You're completely right, Rob.
However, it looks like something isn't executing in our scripts accurately. So, we aren't getting it in either case.

RE: unLoadEvent Actions Captured? - ben.hastings - 10-08-2013 10:37 PM

looks to have been a problem with the minify service we were utilizing.

It decided to combine some logic into an if statement rather than executing it if the conditions were met, so the request wouldn't fire. Now, we're getting it when the session closes. Exactly what we expected!