Send the page-closed signal as a keepalive fetch, since WebKit's beacon carries Origin: null

AI Assisted
This commit is contained in:
Seth committed 2026-12-05 00:10:44 -08:00
1 parent 603c871720
commit 4ced32be5c
2 files changed
+16 -1

No files matched your search

+4 -1
View File
@@ -2503,8 +2503,11 @@ async function openOutside(href) {
export function wireChrome() {
addEventListener("pagehide", () => {
// A keepalive fetch, not sendBeacon: WebKit sends a beacon from a page
// with `referrer-policy: no-referrer` with `Origin: null`, which /bye's
// origin check refuses.
try {
navigator.sendBeacon("/bye");
fetch("/bye", { method: "POST", keepalive: true }).catch(() => {});
} catch {}
// A page that goes away leaves no dot on the app's taskbar behind it.
tellAttention("plain");