mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Send the page-closed signal as a keepalive fetch, since WebKit's beacon carries Origin: null
AI Assisted
This commit is contained in:
1 parent
603c871720
commit
4ced32be5c
2 files changed
+16
-1
No files matched your search
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user