How to Make a Web App 'Feel' Native
Description
A screenshot of a tweet from user Jay Phelps (@_jayphelps). The tweet presents a scenario: 'Manager: I want our web app to feel more like a native app. You:'. Below this text is an image displaying a single line of JavaScript code in a dark-themed editor: 'window.onerror = window.close;'. The humor comes from the malicious compliance of the developer's solution. Native applications are known to crash and close abruptly upon encountering a critical error. This code implements that exact behavior in a web application by assigning the window's close function to the global error handler, meaning any unhandled JavaScript error will instantly close the browser tab. It's a cynical joke that senior developers appreciate, as it highlights the absurdity of vague, non-technical requests and the dark humor found in literal interpretations of such requests
Comments
7Comment deleted
This is the 'fail-fast' methodology taken to its logical extreme. The app doesn't just crash; it performs a graceful, user-initiated exit... triggered by our code's inability to gracefully handle anything
Nothing boosts perceived performance like a zero-second MTTR - just close the window before Sentry can even report it
After 20 years in tech, I've learned that when product asks for "native-like experience," they mean smooth animations and offline support, but what users actually recognize as native is the app randomly disappearing when they needed it most
Ah yes, the classic 'native app experience' request - because nothing says 'polished mobile app' quite like your browser tab committing seppuku at the first sign of a TypeError. At least you won't have to worry about error monitoring costs when every exception becomes an immediate user ejection. Bonus points: this actually solves the 'users reporting bugs' problem by ensuring they can never finish filing the report
Nothing says “native experience” like window.onerror → window.close - crash‑only design, minus the telemetry, plus a browser that ignores close() unless you opened the tab
We shipped the ‘native feel’ path: window.onerror → window.close. Congrats - our SPA now supports crash‑only software and SRE calls it a self‑inflicted DoS
Native parity nailed: skip the verbose Sentry logs, just nuke the tab - because real apps don't debug, they disappear