frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
594•klaussilveira•11h ago•176 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
901•xnx•17h ago•545 comments

What Is Ruliology?

https://writings.stephenwolfram.com/2026/01/what-is-ruliology/
22•helloplanets•4d ago•17 comments

How we made geo joins 400× faster with H3 indexes

https://floedb.ai/blog/how-we-made-geo-joins-400-faster-with-h3-indexes
95•matheusalmeida•1d ago•22 comments

Unseen Footage of Atari Battlezone Arcade Cabinet Production

https://arcadeblogger.com/2026/02/02/unseen-footage-of-atari-battlezone-cabinet-production/
28•videotopia•4d ago•0 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
203•isitcontent•11h ago•24 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
199•dmpetrov•12h ago•91 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
313•vecti•13h ago•137 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
353•aktau•18h ago•176 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
355•ostacke•17h ago•92 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
459•todsacerdoti•19h ago•231 comments

Delimited Continuations vs. Lwt for Threads

https://mirageos.org/blog/delimcc-vs-lwt
24•romes•4d ago•3 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
259•eljojo•14h ago•155 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
80•quibono•4d ago•19 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
392•lstoll•18h ago•266 comments

Was Benoit Mandelbrot a hedgehog or a fox?

https://arxiv.org/abs/2602.01122
7•bikenaga•3d ago•1 comments

PC Floppy Copy Protection: Vault Prolok

https://martypc.blogspot.com/2024/09/pc-floppy-copy-protection-vault-prolok.html
53•kmm•4d ago•3 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
3•jesperordrup•1h ago•0 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
235•i5heu•14h ago•178 comments

Introducing the Developer Knowledge API and MCP Server

https://developers.googleblog.com/introducing-the-developer-knowledge-api-and-mcp-server/
46•gfortaine•9h ago•13 comments

Why I Joined OpenAI

https://www.brendangregg.com/blog/2026-02-07/why-i-joined-openai.html
122•SerCe•7h ago•103 comments

I spent 5 years in DevOps – Solutions engineering gave me what I was missing

https://infisical.com/blog/devops-to-solutions-engineering
136•vmatsiiako•16h ago•60 comments

Show HN: R3forth, a ColorForth-inspired language with a tiny VM

https://github.com/phreda4/r3
68•phreda4•11h ago•12 comments

Understanding Neural Network, Visually

https://visualrambling.space/neural-network/
271•surprisetalk•3d ago•37 comments

Female Asian Elephant Calf Born at the Smithsonian National Zoo

https://www.si.edu/newsdesk/releases/female-asian-elephant-calf-born-smithsonians-national-zoo-an...
25•gmays•6h ago•7 comments

I now assume that all ads on Apple news are scams

https://kirkville.com/i-now-assume-that-all-ads-on-apple-news-are-scams/
1044•cdrnsf•21h ago•431 comments

Zlob.h 100% POSIX and glibc compatible globbing lib that is faste and better

https://github.com/dmtrKovalenko/zlob
13•neogoose•4h ago•9 comments

Learning from context is harder than we thought

https://hy.tencent.com/research/100025?langVersion=en
171•limoce•3d ago•92 comments

FORTH? Really!?

https://rescrv.net/w/2026/02/06/associative
60•rescrv•19h ago•22 comments

Show HN: Smooth CLI – Token-efficient browser for AI agents

https://docs.smooth.sh/cli/overview
89•antves•1d ago•66 comments
Open in hackernews

Say Bye with JavaScript Beacon

https://hemath.dev/blog/say-bye-with-javascript-beacon/
75•moebrowne•5mo ago

Comments

tux3•5mo ago
If you'd like, you can also Say Bye to Say Bye with JavaScript Beacons in about:config by setting beacon.enabled to false
bilekas•5mo ago
This would be nice but I can't see any option for Chromium/Brave inside the chrome://flags .. Do you know if there is one ?
ravenstine•5mo ago
This mostly works, but I have come across a minority of sites that break because of this. Whether that's a good thing or not is up to interpretation (I keep it disabled).
bilekas•5mo ago
So this is kind of interesting, and I had a look at the spec.

> The data parameter is the BodyInit data that is to be transmitted.

However I couldn't find any information in the Spec itself about the size of the data until it said this :

> The user agent imposes limits on the amount of data that can be sent via this API: [...] If the amount of data to be queued exceeds the user agent limit [...] , this method returns false; a return value of true implies the browser has queued the data for transfer. However, since the actual data transfer happens asynchronously, this method does not provide any information whether the data transfer has succeeded or not.

Am I missing something or does this seem as unreliable as any other method for achieving this ?

How about, and this might be a crazy idea, letting the users leave without annoying them ?

lifthrasiir•5mo ago
Technically speaking a conforming agent can ignore every single sendBeacon call by always returning false. And that's a point: beacons are opportunistic asynchronous requests. You can't do anything when they error anyway, so they should be regarded as hints that agents may or may not honor.
bilekas•5mo ago
Okay so it's basically just a baked in implementation of what people did already but instead of using onUnload they have more visibility into the client context. Seems dirty in a way, the agent could basically internally call the same thing and send any data to their own server on every page?

For example, firefox, If they wanted, could record all your browsing history without notifying you? For any bad actor this seems like an amazing attack point.

swiftcoder•5mo ago
Firefox could do that anyway, whether or not this API exists. Browser implementors need to be at least moderately trustworthy, or no one will use them.
andrewstuart•5mo ago
Where has this been hiding how did I not know about this?
tuzemec•5mo ago
Major hm... analytic tools... like MixPanel support this.
Zealotux•5mo ago
You may not want to rely too much on `beforeunload` events though as it is unreliable on mobile, a good practice if you want to send analytics if to listen to the page visibility:

  document.addEventListener('visibilitychange', () => {
    if (document.visibilityState === 'hidden') {
      navigator.sendBeacon(...);
    }
  });
Of course it can't strictly be considered a "page leave" but for mobile users it's often your best bet: https://developer.chrome.com/docs/web-platform/page-lifecycl...
meindnoch•5mo ago
>Sometimes we want to send a piece of data to our servers when user leaves our website or webapp.

I've never.

>Maybe it’s for for analytics or even auto-logout when they leave the website.

Just don't persist the auth token? Analytics is blocked at the DNS level anyway.

can16358p•5mo ago
There might be some sensitive applications where server might want to immediately revoke credentials server-side though.
meindnoch•5mo ago
And what will this hyper-sensitive application do if I yank the power cable from the computer? Or if I quit the browser with kill -9?

See, this is one of those "features" that clueless PMs ask their developers to implement, not having the technical knowledge to realize that their idea is unsalvageable. My other favorite is email address "validation" with ad hoc string format checks.

can16358p•5mo ago
It's just an extra measure, not protecting the server from a malicious user, but an honest user's potential mismanagement of credentials.
DanielHB•5mo ago
This is neat, but don't service-workers persist for like 5s (non-deterministic) before being unloaded?
Arch-TK•5mo ago
Surely if you want to reliably do some action when a user leaves your page then some persistent connection which dies is by far the most reliable option...?

I'm no frontend expert but cant you just open a websocket and when the websocket dies from the server's perspective, you have your cue to do whatever cleanup you wanted to do?

I also agree with the others here that there shouldn't really be a _need_ for this kind of feature.

bilekas•5mo ago
> I'm no frontend expert but cant you just open a websocket and when the websocket dies from the server's perspective, you have your cue to do whatever cleanup you wanted to do?

If I'm not mistaken, and I very well might be, it's kind of the same, however a WS connection here may be less reliable, infact if the user has a spotty connection, when you think "That user left", in the case of a local cleanup, okay that could run on the client side, however this beacon seems to be aimed at sending data back to the server when you leave, in the case of a dropped connection, you wont be able to send the data back anyway to the server.

For this 'browser' based implementation under the hood, the browser *should* have more insight into the real intention of the users exit.

Arch-TK•5mo ago
I really wouldn't want to be doing anything that requires reliability on the back of either solution as user agents can just opt to never send beacons.
Etheryte•5mo ago
Keeping a websocket alive would work, but then you're stuck holding a websocket for all of your users for the full session. Fine if you need a socket anyway, pretty wasteful if you don't. Sockets are pretty cheap these days, but I wouldn't really give this serious thought for a page with a lot of users.
Arch-TK•5mo ago
Holding a socket is very cheap. Unless websockets introduce some overhead I am not aware of.
afavour•5mo ago
You're right that a persistent connection is the most reliable option. But it's also significantly more difficult to scale and will cause battery drain on mobile devices. The Beacon API is a better alternative for not-entirely-essential cases like analytics.
Arch-TK•5mo ago
[delayed]
azangru•5mo ago
I remember when beacons were recently discussed here, someone mentioned the fetchLater API: https://developer.mozilla.org/en-US/docs/Web/API/fetchLater_...
Brysonbw•5mo ago
One of my favorite Web APIs
AndrewStephens•5mo ago
The beacon API has exactly one use - reliable analytics. Sending a ping on leaving the page is a pretty contrived example - the beacon API is useful at any time.

I use the beacon API in my homebuilt hit-counter. It means that even if the user navigates away before the hit is registered, the request will still have a fair chance of being received by my server.

Of course there are other ways of doing this, but who wants to muck around with service workers or websockets when there is a simple, well-supported API that does exactly what you want?

Thorrez•5mo ago
Could you count hits on the server when serving the page?

I guess caching might break that depending on cache settings. And for SPAs, it might not work as desired.

dspillett•5mo ago
Calling out as the page closes, assuming you called out at out listed too, tells you how long the user was there. Not entirely reliable of course as they could have opened it in the background so had it open a while before dismissing it without looking at it at all.
Thorrez•5mo ago
I should have been clearer. I was replying to the "I use the beacon API in my homebuilt hit-counter." part.
AndrewStephens•5mo ago
There are several reasons that you cannot just count the number of times your server has served the page.

The biggest is bots - on my site (and I assume most others), legitimate requests are far, far outweighed by bots. Sometimes you can tell that they are bots but it is very common for bots to pretend to be real users. Oftentimes you can't tell from a single request but only but looking at the pattern of requests.

Some bots do take the trouble of running scripts on the page but thankfully they are in the minority so far.

Caching would certainly break the system as well, in the other direction.

immibis•5mo ago
Why do we automatically suppose that bot requests are "not legitimate" btw?
wredcoll•5mo ago
For the same reason we assume a random tiger wants to eat us.
meindnoch•5mo ago
That's tigrophobic.
baxuz•5mo ago
One downside is that it's not available in web workers.
LunaSea•5mo ago
Is the Beacon API functional nowadays? I remember that a two or three years ago benchmarks showed that the original window.onunload (I believe) was able to log more event than the new Beacon API.
jauntywundrkind•5mo ago
One concern I have is that interactions on sites like HN might not have gotten to the server. Wouldn't this be useful to make sure something like an upvote gets through, even if I navigate away quickly?
stevage•5mo ago
>Sending a ping on leaving the page is a pretty contrived example

I don't think it's a contrived example. It seems to be one of the main use cases. From the spec:

> The main use case for the Beacon API is to send analytics such as client-side events or session data to the server. Historically, websites have used XMLHttpRequest for this, but browsers do not guarantee to send these asynchronous requests in some circumstances (for example, if the page is about to be unloaded). To combat this, websites have resorted to various techniques, such as making the request synchronous, that have a bad effect on responsiveness. Because beacon requests are both asynchronous and guaranteed to be sent, they combine good performance characteristics and reliability.

lapcat•5mo ago
[self-promotion:] My Safari extension StopTheMadness Pro disables the Beacon API.
srameshc•5mo ago
Interesting. Could you elaborate on the rationale behind disabling the Beacon API?
vinnymac•5mo ago
Not OP. It’s mostly used for tracking user behavior, and is rarely critical functionality for a given web page.
snickerdoodle12•5mo ago
It's solely created for advertisers to be able to implement their tracking more reliably. There is almost no way to use it in a way that benefits the user.
Chabsff•5mo ago
Yes, but you could also say that it was created so that advertisers stop doing complete nonsense like tracking pixels and other roundabout ways of accomplishing the same thing in ways that are sometimes (often?) detrimental to the user.

Sure, it's a form of capitulation to advertisers, that doesn't necessarily mean that it doesn't benefit the user.

If advertisers are going to be doing that stuff no matter what, corralling them has advantages. If anything, it makes creating an extension like OP's a lot easier than playing whack-a-mole with a litany of random techniques.

snickerdoodle12•5mo ago
Sure, which is exactly the rationale for disabling it.
zenethian•5mo ago
You're a hero, and I love your extension. Thank you for all of your hard work.
paultopia•5mo ago
How about don't instead
junon•5mo ago
> Maybe it’s for for analytics or even auto-logout when they leave the website.

Yeah, don't do either of these things. Don't log me out when I close the tab. Don't spy on me after I close the tab.

Very simple!

afavour•5mo ago
> Don't spy on me after I close the tab.

Maybe a small nit but it isn't spying on you after you close the tab. It is spying on you the moment you close the tab and no later.

junon•5mo ago
If it's performing a request upon closing the tab, only two options are available:

1. it delays closing until it completes, which is a performance hit, or

2. it's performing more website specific background work when I've told the browser not to by hitting the Close Tab button.

subscribed•5mo ago
Interrupt the request, clean up after the tab.

That's all. The second option is garbage collector. Not sure why the website is entitled to execute any code when I decided to close it.

01HNNWZ0MV43FF•5mo ago
Don't spy on me
hdjrudni•5mo ago
> Don't log me out when I close the tab.

What about being logged out of a real-time chat with your friend? Wouldn't you like them to know you are no longer connected? Or do you prefer to trick them with a little green 'connected' bubble that can no longer update?

vince14•5mo ago
Their fetch call is missing `keepalive: true`.

    When set to true, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete. This enables a fetch() request to send analytics at the end of a session even if the user navigates away from or closes the page.
https://developer.mozilla.org/en-US/docs/Web/API/RequestInit...
righthand•5mo ago
Can I disable this in my Chrome browser? I don’t want tracking companies to have more convenience.

In Firefox you can disable it by beacon.enable = false.

Hnrobert42•5mo ago
Could you send the beacon every five minutes? When the beacon stops coming in for 30 minutes assume that the tab closed or the user went off-line.
ivanjermakov•5mo ago
> every five minutes

This is tricky in JavaScript, because timers are asleep/throttled in inactive tabs: https://developer.mozilla.org/en-US/docs/Web/API/Window/setT...

And if onbeforeleave analytics is not evil, doing stuff in inactive tabs is certainly is.

hoppp•5mo ago
You could just have a websocket open then. But its unreliable because if the user's internet cuts out maybe they still on the tab, so watching websocket disconnect is not perfect either
daveoc64•5mo ago
I was thinking this might be useful for locking records while users are looking at them, but that's probably better served with a periodic ping that ends when the user leaves the page.
afavour•5mo ago
Interesting to see so much resistance to the Beacon API. I think it's great. I've gotten a lot of useful data over the years via user analytics and routing all analytics requests through a dedicated API makes it trivial for users who care to disable it.
wrsh07•5mo ago
Something many people refuse to believe is that "understanding your users" doesn't have to be nefarious or about serving ads.

It's important to realize that key assumptions your app makes (nobody is accessing my b2b saas app from a phone) are incorrect. It's important to understand user workflows.

There are higher touch ways to do this (user research is great!), and you should let users opt out, but someone trying to improve the user experience also needs to understand how users are defying their expectations

dmvjs•5mo ago
this isn't new at all, ten years ago I used it to open an Android app without a user gesture https://paul.kinlan.me/deep-app-linking-on-android-and-chrom...
chaz6•5mo ago
In networking, there is a similar concept called "dyinggasp" in which a device will send a signal when power is lost. This can help the operator determine if a service is likely to be down due to a power failure or a signal interruption.
hoppp•5mo ago
I didn't know it existed, it is handy
stevage•5mo ago
I tried to figure out how much data you can send exactly. It's not very clear from the spec:

> If the amount of data that can be queued to be sent by keepalive enabled requests is exceeded by the size of transmittedData (as defined in HTTP-network-or-cache fetch), set the return value to false and terminate these steps.

Does anyone know?

mediumsmart•5mo ago
Bye JavaScript.