Brutkey

mcc
@mcc@mastodon.social

TIL about navigator.sendBeacon. Is there literally any reason to use this method in a world where Fetch exists?

https://floss.social/@servo/114993886078642447


leo vriska :light2:
@leo@60228.dev

@mcc@mastodon.social the request isn't cancelled if the user navigates off the page

leo vriska :light2:
@leo@60228.dev

@mcc@mastodon.social it's very specifically intended so that analytics can track when a user leaves the site

mcc
@mcc@mastodon.social

@leo@60228.dev Huh. Is that pro-user?

Cassandrich
@dalias@hachyderm.io

@mcc@mastodon.social @leo@60228.dev No, it's very explicitly malicious.

Kornel
@kornel@mastodon.social

@dalias@hachyderm.io @mcc@mastodon.social @leo@60228.dev It's been added (along with <a ping>) as a lesser evil, because sites can already do such tracking via hacks (sync xhr, busy-looping, worker polling). This doesn't enable more tracking, but avoids jank caused by the workarounds, and theoretically allows users to disable it.

However, the plan failed. Since it's explicitly a tracking feature, it ended up being usually unimplemented or disabled by default, so sites that want to track keep using the hacks.

mcc
@mcc@mastodon.social

@dalias@hachyderm.io @leo@60228.dev Is it useful for a chat app to be able to notify the people you are talking to when you go offline?

khm
@khm@hj.9fs.net

it could be used for that, but chat apps generally already have service workers running to do notifications on the client side, so they typically use those to report presence changes.

besides which, the beacon spec mandates that the browser engine can coalesce beacons or deprioritize them, so they're not reliable enough for anything that might benefit the user.

it's a focused and purpose-built tracking mechanism and you lose nothing by disabling them.

CC:
@dalias@hachyderm.io @leo@60228.dev

khm
@khm@hj.9fs.net

it could be used for that, but chat apps generally already have service workers running to do notifications on the client side, so they typically use those to report presence changes.

besides which, the beacon spec mandates that the browser engine can coalesce beacons or deprioritize them, so they're not reliable enough for anything that might benefit the user.

it's a focused and purpose-built tracking mechanism and you lose nothing by disabling them.

CC:
@dalias@hachyderm.io @leo@60228.dev