demo · v139

Retry Options

Keepalive fetches (used for unload-time logging) now support a retry policy. Simulate flaky network and pick a retry policy — the timeline shows how the request resolves.

60%
3
500

the code

await fetch("/log", {
  method: "POST",
  keepalive: true,
  body: payload,
  retryOptions: { maxRetries: 3, initialDelay: 500 },
});

see also