Skip to content

api.Navigator.sendBeacon - Browser support: should warn about payload size limits #20721

@ajhyndman

Description

@ajhyndman

What type of issue is this?

Missing compatibility data

What information was incorrect, unhelpful, or incomplete?

Both Chromium and Safari implement strict payload size limits on data sent via sendBeacon or fetch with keepalive: true.

This is really poorly documented across the web, and extremely difficult to diagnose.

What browsers does this problem apply to, if applicable?

Chromium (Chrome, Edge 79+, Opera, Samsung Internet), Safari

What did you expect to see?

A note in this article that many browsers impose strict size limits on beacon requests could have saved me days of investigation.

Did you test this? If so, how?

I spent the last several days investigating an issue that turned out to be a symptom of this behaviour.

To reproduce is pretty simple though, simply attempt to call sendBeacon in chrome with a request body larger than 64 kB.

navigator.sendBeacon("http://google.com", new Array(100000).join("Z"));

image

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

I found this comment buried in a w3c pull request that references the limitation:

w3c/beacon#39 (comment)

Do you have anything more you want to share?

No response

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

MDN metadata

MDN page report details
  • Query: api.Navigator.sendBeacon
  • Report started: 2023-09-15T23:09:46.198Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    data:apiCompat data for Web APIs. https://developer.mozilla.org/docs/Web/API

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions