Re: Beacon API

My personal experience is different. We found that using img tags is not that reliable. Especially in Firefox we recently saw some problems. Img tags in general have the disadvantage that the amount of data that can be set is rather limited. While this obviously should be kept as small as possible, the information available via resource timing will increase the amount of data that gets sent.

Is there a way we can integrate this into a W3C test suite to check how different browsers behave in this case

// Alois

From: Andy Davies <dajdavies@gmail.com<mailto:dajdavies@gmail.com>>
Date: Sunday, February 17, 2013 11:12 PM
To: Maciej Stachowiak <mjs@apple.com<mailto:mjs@apple.com>>
Cc: "ifette@google.com<mailto:ifette@google.com>" <ifette@google.com<mailto:ifette@google.com>>, Anne van Kesteren <annevk@annevk.nl<mailto:annevk@annevk.nl>>, Web Applications Working Group WG <public-webapps@w3.org<mailto:public-webapps@w3.org>>, "public-web-perf@w3.org<mailto:public-web-perf@w3.org>" <public-web-perf@w3.org<mailto:public-web-perf@w3.org>>
Subject: Re: Beacon API
Resent-From: "public-web-perf@w3.org<mailto:public-web-perf@w3.org>" <public-web-perf@w3.org<mailto:public-web-perf@w3.org>>
Resent-Date: Sunday, February 17, 2013 11:13 PM

On 16 February 2013 05:25, Maciej Stachowiak <mjs@apple.com<mailto:mjs@apple.com>> wrote:

BTW as far as I know the best current nonblocking technique to phone home on unload is to create an <img> in your unload handler pointing to the ping URL, this will result in reliable delivery without blocking at least in IE and WebKit-based browsers. I've found it hard to convince even knowledgable web developers to use this technique or <a ping> over synchronous XHR, even sites that are otherwise willing to do Safari-specific optimizations. I am not sure why sync XHR in unload is so tantalizing.


I asked Phillip Tellis (creater of Boomerang) about this and his experience is: (copied because he can't post to the list)

"A beacon may be sent using a GET request via an Image object in a listener for either the onunload,the onbeforeunload or the onpagehide events.  No browser blocks if this is sent via the onbeforeunload event, however Opera does not support this event.  Firefox is the only browser that blocks for Image requests in the onunload event.

Additionally, attaching a listener to the onunload event affects Page Cache in most browsers, so one should avoid that in any event.

The solution we've come up with for boomerang (a general purpose beaconing solution primarily used for web performance beacons) is to attach a listener to the beforeunload event and either the pagehide or unload, depending on which is available (pagehide is checked first).  The first of these events to fire sends the beacon out and removes the listener from the other.  This has allowed us to fire beacons on every page unload without affecting unload time and without beacon loss."

Andy
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. Compuware Austria GmbH (registration number FN 91482h) is a company registered in Vienna whose registered office is at 1120 Wien, Austria, Am Euro Platz 2 / Geb?ude G.

Received on Wednesday, 20 February 2013 07:25:09 UTC