WICG/pending-beacon

Any use cases with data type `Blob`

Closed this issue · 3 comments

setData(data): Set the current beacon data. The data argument would take the same types as the sendBeacon method’s data parameter. That is, one of ArrayBuffer, ArrayBufferView, Blob, string, FormData, or URLSearchParams.

The current setData(data) specifies to support Blob. But is there any critical use case to support sending file-like object in unload beacon?

The Blob format is currently supported by navigator.sendBeacon(), which this new API is supposed to be an improvement on. If Blob is not supported in this new API it could be a blocker for adoption. It would also complicate the polyfill story, which is not ideal.

My suggestion would be to add telemetry data for usage of Blob with navigator.sendBeacon() and only remove it if usage is near 0.

Anecdotally I use Blob with sendBeacon to send JSON payloads to the server.

Thanks for all your feedback. The current decision is to still support Blob.